From 00696f5f37047add24db011df63838158fe50acb Mon Sep 17 00:00:00 2001
From: "Kevin P. Fleming" <kpfleming@digium.com>
Date: Tue, 1 Jul 2008 17:22:47 +0000
Subject: [PATCH] make the AIS checking a little more generic, and have a more
 useful configure script command line option for OpenAIS

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127017 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 build_tools/menuselect-deps.in   |   3 +-
 configure                        | 960 +++----------------------------
 configure.ac                     |  32 +-
 include/asterisk/autoconfig.h.in |  21 +-
 makeopts.in                      |   7 +-
 res/Makefile                     |   2 +
 res/ais/ais.h                    |  12 +-
 res/res_ais.c                    |   3 +-
 8 files changed, 132 insertions(+), 908 deletions(-)

diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index fba1dd3084..45198c30e3 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -30,8 +30,7 @@ PGSQL=@PBX_PGSQL@
 POPT=@PBX_POPT@
 PORTAUDIO=@PBX_PORTAUDIO@
 PRI=@PBX_PRI@
-SACLM=@PBX_SACLM@
-SAEVT=@PBX_SAEVT@
+AIS=@PBX_AIS@
 RADIUS=@PBX_RADIUS@
 SPANDSP=@PBX_SPANDSP@
 SPEEX=@PBX_SPEEX@
diff --git a/configure b/configure
index d72988fbda..03181677c9 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 126226 .
+# From configure.ac Revision: 126356 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for asterisk 1.6.
 #
@@ -880,14 +880,10 @@ SDL_IMAGE_LIB
 SDL_IMAGE_INCLUDE
 SDL_IMAGE_DIR
 PBX_SDL_IMAGE
-SACLM_LIB
-SACLM_INCLUDE
-SACLM_DIR
-PBX_SACLM
-SAEVT_LIB
-SAEVT_INCLUDE
-SAEVT_DIR
-PBX_SAEVT
+OPENAIS_LIB
+OPENAIS_INCLUDE
+OPENAIS_DIR
+PBX_OPENAIS
 SPEEX_LIB
 SPEEX_INCLUDE
 SPEEX_DIR
@@ -975,6 +971,9 @@ OPENH323_INCDIR
 OPENH323_LIBDIR
 OPENH323_SUFFIX
 OPENH323_BUILD
+PBX_AIS
+AIS_INCLUDE
+AIS_LIB
 PBX_SPEEX_PREPROCESS
 CONFIG_GMIME
 EDITLINE_LIB
@@ -1621,8 +1620,7 @@ Optional Packages:
   --with-radius=PATH      use Radius Client files in PATH
   --with-sdl=PATH         use Sdl files in PATH
   --with-SDL_image=PATH   use Sdl Image library files in PATH
-  --with-SaClm=PATH       use SAForum AIS CLM files in PATH
-  --with-SaEvt=PATH       use SAForum AIS EVT files in PATH
+  --with-openais=PATH     use OpenAIS files in PATH
   --with-speex=PATH       use Speex files in PATH
   --with-speexdsp=PATH    use Speexdsp files in PATH
   --with-sqlite=PATH      use SQLite files in PATH
@@ -9015,56 +9013,28 @@ fi
 
 
 
-    SACLM_DESCRIP="SAForum AIS CLM"
-    SACLM_OPTION="SaClm"
+    OPENAIS_DESCRIP="OpenAIS"
+    OPENAIS_OPTION="openais"
 
-# Check whether --with-SaClm was given.
-if test "${with_SaClm+set}" = set; then
-  withval=$with_SaClm;
+# Check whether --with-openais was given.
+if test "${with_openais+set}" = set; then
+  withval=$with_openais;
 	case ${withval} in
 	n|no)
-	USE_SACLM=no
+	USE_OPENAIS=no
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SACLM"
+	ac_mandatory_list="${ac_mandatory_list} OPENAIS"
 	;;
 	*)
-	SACLM_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SACLM"
+	OPENAIS_DIR="${withval}"
+	ac_mandatory_list="${ac_mandatory_list} OPENAIS"
 	;;
 	esac
 
 fi
 
-    PBX_SACLM=0
-
-
-
-
-
-
-    SAEVT_DESCRIP="SAForum AIS EVT"
-    SAEVT_OPTION="SaEvt"
-
-# Check whether --with-SaEvt was given.
-if test "${with_SaEvt+set}" = set; then
-  withval=$with_SaEvt;
-	case ${withval} in
-	n|no)
-	USE_SAEVT=no
-	;;
-	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SAEVT"
-	;;
-	*)
-	SAEVT_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SAEVT"
-	;;
-	esac
-
-fi
-
-    PBX_SAEVT=0
+    PBX_OPENAIS=0
 
 
 
@@ -42243,20 +42213,29 @@ _ACEOF
 fi
 
 
+# This is a bit complex... in reality, Asterisk's AIS support is dependent on finding
+# *any* implementation of AIS, not just OpenAIS. However, the configure script needs
+# to know the specifics of each possible implementation, and then represent the one
+# that was found as 'AIS'.
+
+PBX_AIS=0
+
+# OpenAIS installs its libraries into /usr/lib/openais by default, so check there
+
 
-if test "x${PBX_SACLM}" != "x1" -a "${USE_SACLM}" != "no"; then
+if test "x${PBX_OPENAIS}" != "x1" -a "${USE_OPENAIS}" != "no"; then
    pbxlibdir=""
-   # if --with-SACLM=DIR has been specified, use it.
-   if test "x${SACLM_DIR}" != "x"; then
-      if test -d ${SACLM_DIR}/lib; then
-      	 pbxlibdir="-L${SACLM_DIR}/lib"
+   # if --with-OPENAIS=DIR has been specified, use it.
+   if test "x${OPENAIS_DIR}" != "x"; then
+      if test -d ${OPENAIS_DIR}/lib; then
+      	 pbxlibdir="-L${OPENAIS_DIR}/lib"
       else
-      	 pbxlibdir="-L${SACLM_DIR}"
+      	 pbxlibdir="-L${OPENAIS_DIR}"
       fi
    fi
    pbxfuncname="saClmInitialize"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SACLM_FOUND=yes
+      AST_OPENAIS_FOUND=yes
    else
       as_ac_Lib=`echo "ac_cv_lib_SaClm_${pbxfuncname}" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lSaClm" >&5
@@ -42322,26 +42301,26 @@ ac_res=`eval echo '${'$as_ac_Lib'}'`
 	       { echo "$as_me:$LINENO: result: $ac_res" >&5
 echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  AST_SACLM_FOUND=yes
+  AST_OPENAIS_FOUND=yes
 else
-  AST_SACLM_FOUND=no
+  AST_OPENAIS_FOUND=no
 fi
 
    fi
 
    # now check for the header.
-   if test "${AST_SACLM_FOUND}" = "yes"; then
-      SACLM_LIB="${pbxlibdir} -lSaClm -L/usr/lib/openais"
-      # if --with-SACLM=DIR has been specified, use it.
-      if test "x${SACLM_DIR}" != "x"; then
-	 SACLM_INCLUDE="-I${SACLM_DIR}/include"
+   if test "${AST_OPENAIS_FOUND}" = "yes"; then
+      OPENAIS_LIB="${pbxlibdir} -lSaClm -L/usr/lib/openais"
+      # if --with-OPENAIS=DIR has been specified, use it.
+      if test "x${OPENAIS_DIR}" != "x"; then
+	 OPENAIS_INCLUDE="-I${OPENAIS_DIR}/include"
       fi
-      SACLM_INCLUDE="${SACLM_INCLUDE} "
+      OPENAIS_INCLUDE="${OPENAIS_INCLUDE} "
       if test "xopenais/saClm.h" = "x" ; then	# no header, assume found
-         SACLM_HEADER_FOUND="1"
+         OPENAIS_HEADER_FOUND="1"
       else				# check for the header
          saved_cppflags="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${SACLM_INCLUDE} "
+         CPPFLAGS="${CPPFLAGS} ${OPENAIS_INCLUDE} "
 	 if test "${ac_cv_header_openais_saClm_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for openais/saClm.h" >&5
 echo $ECHO_N "checking for openais/saClm.h... $ECHO_C" >&6; }
@@ -42473,31 +42452,31 @@ echo "${ECHO_T}$ac_cv_header_openais_saClm_h" >&6; }
 
 fi
 if test $ac_cv_header_openais_saClm_h = yes; then
-  SACLM_HEADER_FOUND=1
+  OPENAIS_HEADER_FOUND=1
 else
-  SACLM_HEADER_FOUND=0
+  OPENAIS_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${saved_cppflags}"
       fi
-      if test "x${SACLM_HEADER_FOUND}" = "x0" ; then
-         SACLM_LIB=""
-         SACLM_INCLUDE=""
+      if test "x${OPENAIS_HEADER_FOUND}" = "x0" ; then
+         OPENAIS_LIB=""
+         OPENAIS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-	    SACLM_LIB=""
+	    OPENAIS_LIB=""
 	 fi
-         PBX_SACLM=1
+         PBX_OPENAIS=1
          # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_SACLM 1
+#define HAVE_OPENAIS 1
 _ACEOF
 
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_SACLM_VERSION
+#define HAVE_OPENAIS_VERSION
 _ACEOF
 
       fi
@@ -42505,812 +42484,44 @@ _ACEOF
 fi
 
 
-if test "x${PBX_SACLM}" != "x1" -a "${USE_SACLM}" != "no"; then
-   pbxlibdir=""
-   # if --with-SACLM=DIR has been specified, use it.
-   if test "x${SACLM_DIR}" != "x"; then
-      if test -d ${SACLM_DIR}/lib; then
-      	 pbxlibdir="-L${SACLM_DIR}/lib"
-      else
-      	 pbxlibdir="-L${SACLM_DIR}"
-      fi
-   fi
-   pbxfuncname="saClmInitialize"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SACLM_FOUND=yes
+if test "${PBX_OPENAIS}" = 1; then
+   PBX_AIS=1
+   if test -n "${OPENAIS_DIR}"; then
+      AIS_INCLUDE="${OPENAIS_INCLUDE}/openais"
+      AIS_LIB="-lSaEvt ${OPENAIS_LIB}"
    else
-      as_ac_Lib=`echo "ac_cv_lib_SaClm_${pbxfuncname}" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lSaClm" >&5
-echo $ECHO_N "checking for ${pbxfuncname} in -lSaClm... $ECHO_C" >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lSaClm ${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 ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  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); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_Lib=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Lib=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval echo '${'$as_ac_Lib'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  AST_SACLM_FOUND=yes
-else
-  AST_SACLM_FOUND=no
-fi
-
+      AIS_INCLUDE="-I/usr/include/openais"
+      AIS_LIB="-lSaClm -lSaEvt -L/usr/lib/openais"
    fi
-
-   # now check for the header.
-   if test "${AST_SACLM_FOUND}" = "yes"; then
-      SACLM_LIB="${pbxlibdir} -lSaClm "
-      # if --with-SACLM=DIR has been specified, use it.
-      if test "x${SACLM_DIR}" != "x"; then
-	 SACLM_INCLUDE="-I${SACLM_DIR}/include"
-      fi
-      SACLM_INCLUDE="${SACLM_INCLUDE} "
-      if test "xopenais/saClm.h" = "x" ; then	# no header, assume found
-         SACLM_HEADER_FOUND="1"
-      else				# check for the header
-         saved_cppflags="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${SACLM_INCLUDE} "
-	 if test "${ac_cv_header_openais_saClm_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for openais/saClm.h" >&5
-echo $ECHO_N "checking for openais/saClm.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openais_saClm_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openais_saClm_h" >&5
-echo "${ECHO_T}$ac_cv_header_openais_saClm_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking openais/saClm.h usability" >&5
-echo $ECHO_N "checking openais/saClm.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 <openais/saClm.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); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; 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 core 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 openais/saClm.h presence" >&5
-echo $ECHO_N "checking openais/saClm.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 <openais/saClm.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 && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.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: openais/saClm.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: openais/saClm.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saClm.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: openais/saClm.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: openais/saClm.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: openais/saClm.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saClm.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: openais/saClm.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saClm.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: openais/saClm.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saClm.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: openais/saClm.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saClm.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: openais/saClm.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saClm.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: openais/saClm.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to www.asterisk.org ##
-## ------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for openais/saClm.h" >&5
-echo $ECHO_N "checking for openais/saClm.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openais_saClm_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_openais_saClm_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openais_saClm_h" >&5
-echo "${ECHO_T}$ac_cv_header_openais_saClm_h" >&6; }
-
-fi
-if test $ac_cv_header_openais_saClm_h = yes; then
-  SACLM_HEADER_FOUND=1
-else
-  SACLM_HEADER_FOUND=0
-fi
 
-
-         CPPFLAGS="${saved_cppflags}"
-      fi
-      if test "x${SACLM_HEADER_FOUND}" = "x0" ; then
-         SACLM_LIB=""
-         SACLM_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-	    SACLM_LIB=""
-	 fi
-         PBX_SACLM=1
-         # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SACLM 1
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SACLM_VERSION
-_ACEOF
-
-      fi
-   fi
-fi
-
-
-if test "x${PBX_SAEVT}" != "x1" -a "${USE_SAEVT}" != "no"; then
+if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
    pbxlibdir=""
-   # if --with-SAEVT=DIR has been specified, use it.
-   if test "x${SAEVT_DIR}" != "x"; then
-      if test -d ${SAEVT_DIR}/lib; then
-      	 pbxlibdir="-L${SAEVT_DIR}/lib"
+   # if --with-SPEEX=DIR has been specified, use it.
+   if test "x${SPEEX_DIR}" != "x"; then
+      if test -d ${SPEEX_DIR}/lib; then
+      	 pbxlibdir="-L${SPEEX_DIR}/lib"
       else
-      	 pbxlibdir="-L${SAEVT_DIR}"
+      	 pbxlibdir="-L${SPEEX_DIR}"
       fi
    fi
-   pbxfuncname="saEvtInitialize"
+   pbxfuncname="speex_encode"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SAEVT_FOUND=yes
+      AST_SPEEX_FOUND=yes
    else
-      as_ac_Lib=`echo "ac_cv_lib_SaEvt_${pbxfuncname}" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lSaEvt" >&5
-echo $ECHO_N "checking for ${pbxfuncname} in -lSaEvt... $ECHO_C" >&6; }
+      as_ac_Lib=`echo "ac_cv_lib_speex_${pbxfuncname}" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lspeex" >&5
+echo $ECHO_N "checking for ${pbxfuncname} in -lspeex... $ECHO_C" >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lSaEvt ${pbxlibdir} -L/usr/lib/openais $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 ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  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); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_Lib=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Lib=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval echo '${'$as_ac_Lib'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  AST_SAEVT_FOUND=yes
-else
-  AST_SAEVT_FOUND=no
-fi
-
-   fi
-
-   # now check for the header.
-   if test "${AST_SAEVT_FOUND}" = "yes"; then
-      SAEVT_LIB="${pbxlibdir} -lSaEvt -L/usr/lib/openais"
-      # if --with-SAEVT=DIR has been specified, use it.
-      if test "x${SAEVT_DIR}" != "x"; then
-	 SAEVT_INCLUDE="-I${SAEVT_DIR}/include"
-      fi
-      SAEVT_INCLUDE="${SAEVT_INCLUDE} "
-      if test "xopenais/saEvt.h" = "x" ; then	# no header, assume found
-         SAEVT_HEADER_FOUND="1"
-      else				# check for the header
-         saved_cppflags="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${SAEVT_INCLUDE} "
-	 if test "${ac_cv_header_openais_saEvt_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for openais/saEvt.h" >&5
-echo $ECHO_N "checking for openais/saEvt.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openais_saEvt_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openais_saEvt_h" >&5
-echo "${ECHO_T}$ac_cv_header_openais_saEvt_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking openais/saEvt.h usability" >&5
-echo $ECHO_N "checking openais/saEvt.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 <openais/saEvt.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); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; 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 core 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 openais/saEvt.h presence" >&5
-echo $ECHO_N "checking openais/saEvt.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 <openais/saEvt.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 && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.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: openais/saEvt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: openais/saEvt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: openais/saEvt.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: openais/saEvt.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: openais/saEvt.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: openais/saEvt.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: openais/saEvt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: openais/saEvt.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: openais/saEvt.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to www.asterisk.org ##
-## ------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for openais/saEvt.h" >&5
-echo $ECHO_N "checking for openais/saEvt.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openais_saEvt_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_openais_saEvt_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openais_saEvt_h" >&5
-echo "${ECHO_T}$ac_cv_header_openais_saEvt_h" >&6; }
-
-fi
-if test $ac_cv_header_openais_saEvt_h = yes; then
-  SAEVT_HEADER_FOUND=1
-else
-  SAEVT_HEADER_FOUND=0
-fi
-
-
-         CPPFLAGS="${saved_cppflags}"
-      fi
-      if test "x${SAEVT_HEADER_FOUND}" = "x0" ; then
-         SAEVT_LIB=""
-         SAEVT_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-	    SAEVT_LIB=""
-	 fi
-         PBX_SAEVT=1
-         # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SAEVT 1
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SAEVT_VERSION
-_ACEOF
-
-      fi
-   fi
-fi
-
-
-if test "x${PBX_SAEVT}" != "x1" -a "${USE_SAEVT}" != "no"; then
-   pbxlibdir=""
-   # if --with-SAEVT=DIR has been specified, use it.
-   if test "x${SAEVT_DIR}" != "x"; then
-      if test -d ${SAEVT_DIR}/lib; then
-      	 pbxlibdir="-L${SAEVT_DIR}/lib"
-      else
-      	 pbxlibdir="-L${SAEVT_DIR}"
-      fi
-   fi
-   pbxfuncname="saEvtInitialize"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SAEVT_FOUND=yes
-   else
-      as_ac_Lib=`echo "ac_cv_lib_SaEvt_${pbxfuncname}" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lSaEvt" >&5
-echo $ECHO_N "checking for ${pbxfuncname} in -lSaEvt... $ECHO_C" >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lSaEvt ${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 ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  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); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_Lib=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Lib=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval echo '${'$as_ac_Lib'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  AST_SAEVT_FOUND=yes
-else
-  AST_SAEVT_FOUND=no
-fi
-
-   fi
-
-   # now check for the header.
-   if test "${AST_SAEVT_FOUND}" = "yes"; then
-      SAEVT_LIB="${pbxlibdir} -lSaEvt "
-      # if --with-SAEVT=DIR has been specified, use it.
-      if test "x${SAEVT_DIR}" != "x"; then
-	 SAEVT_INCLUDE="-I${SAEVT_DIR}/include"
-      fi
-      SAEVT_INCLUDE="${SAEVT_INCLUDE} "
-      if test "xopenais/saEvt.h" = "x" ; then	# no header, assume found
-         SAEVT_HEADER_FOUND="1"
-      else				# check for the header
-         saved_cppflags="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${SAEVT_INCLUDE} "
-	 if test "${ac_cv_header_openais_saEvt_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for openais/saEvt.h" >&5
-echo $ECHO_N "checking for openais/saEvt.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openais_saEvt_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openais_saEvt_h" >&5
-echo "${ECHO_T}$ac_cv_header_openais_saEvt_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking openais/saEvt.h usability" >&5
-echo $ECHO_N "checking openais/saEvt.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 <openais/saEvt.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); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; 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 core 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 openais/saEvt.h presence" >&5
-echo $ECHO_N "checking openais/saEvt.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 <openais/saEvt.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 && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.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: openais/saEvt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: openais/saEvt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: openais/saEvt.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: openais/saEvt.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: openais/saEvt.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: openais/saEvt.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: openais/saEvt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: openais/saEvt.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openais/saEvt.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: openais/saEvt.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to www.asterisk.org ##
-## ------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for openais/saEvt.h" >&5
-echo $ECHO_N "checking for openais/saEvt.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openais_saEvt_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_openais_saEvt_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openais_saEvt_h" >&5
-echo "${ECHO_T}$ac_cv_header_openais_saEvt_h" >&6; }
-
-fi
-if test $ac_cv_header_openais_saEvt_h = yes; then
-  SAEVT_HEADER_FOUND=1
-else
-  SAEVT_HEADER_FOUND=0
-fi
-
-
-         CPPFLAGS="${saved_cppflags}"
-      fi
-      if test "x${SAEVT_HEADER_FOUND}" = "x0" ; then
-         SAEVT_LIB=""
-         SAEVT_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-	    SAEVT_LIB=""
-	 fi
-         PBX_SAEVT=1
-         # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SAEVT 1
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SAEVT_VERSION
-_ACEOF
-
-      fi
-   fi
-fi
-
-
-
-if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
-   pbxlibdir=""
-   # if --with-SPEEX=DIR has been specified, use it.
-   if test "x${SPEEX_DIR}" != "x"; then
-      if test -d ${SPEEX_DIR}/lib; then
-      	 pbxlibdir="-L${SPEEX_DIR}/lib"
-      else
-      	 pbxlibdir="-L${SPEEX_DIR}"
-      fi
-   fi
-   pbxfuncname="speex_encode"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SPEEX_FOUND=yes
-   else
-      as_ac_Lib=`echo "ac_cv_lib_speex_${pbxfuncname}" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lspeex" >&5
-echo $ECHO_N "checking for ${pbxfuncname} in -lspeex... $ECHO_C" >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lspeex ${pbxlibdir} -lm $LIBS"
+LIBS="-lspeex ${pbxlibdir} -lm $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -50724,14 +49935,10 @@ SDL_IMAGE_LIB!$SDL_IMAGE_LIB$ac_delim
 SDL_IMAGE_INCLUDE!$SDL_IMAGE_INCLUDE$ac_delim
 SDL_IMAGE_DIR!$SDL_IMAGE_DIR$ac_delim
 PBX_SDL_IMAGE!$PBX_SDL_IMAGE$ac_delim
-SACLM_LIB!$SACLM_LIB$ac_delim
-SACLM_INCLUDE!$SACLM_INCLUDE$ac_delim
-SACLM_DIR!$SACLM_DIR$ac_delim
-PBX_SACLM!$PBX_SACLM$ac_delim
-SAEVT_LIB!$SAEVT_LIB$ac_delim
-SAEVT_INCLUDE!$SAEVT_INCLUDE$ac_delim
-SAEVT_DIR!$SAEVT_DIR$ac_delim
-PBX_SAEVT!$PBX_SAEVT$ac_delim
+OPENAIS_LIB!$OPENAIS_LIB$ac_delim
+OPENAIS_INCLUDE!$OPENAIS_INCLUDE$ac_delim
+OPENAIS_DIR!$OPENAIS_DIR$ac_delim
+PBX_OPENAIS!$PBX_OPENAIS$ac_delim
 SPEEX_LIB!$SPEEX_LIB$ac_delim
 SPEEX_INCLUDE!$SPEEX_INCLUDE$ac_delim
 SPEEX_DIR!$SPEEX_DIR$ac_delim
@@ -50754,6 +49961,10 @@ SUPPSERV_DIR!$SUPPSERV_DIR$ac_delim
 PBX_SUPPSERV!$PBX_SUPPSERV$ac_delim
 OPENSSL_LIB!$OPENSSL_LIB$ac_delim
 OPENSSL_INCLUDE!$OPENSSL_INCLUDE$ac_delim
+OPENSSL_DIR!$OPENSSL_DIR$ac_delim
+PBX_OPENSSL!$PBX_OPENSSL$ac_delim
+FREETDS_LIB!$FREETDS_LIB$ac_delim
+FREETDS_INCLUDE!$FREETDS_INCLUDE$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -50795,10 +50006,6 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
-OPENSSL_DIR!$OPENSSL_DIR$ac_delim
-PBX_OPENSSL!$PBX_OPENSSL$ac_delim
-FREETDS_LIB!$FREETDS_LIB$ac_delim
-FREETDS_INCLUDE!$FREETDS_INCLUDE$ac_delim
 FREETDS_DIR!$FREETDS_DIR$ac_delim
 PBX_FREETDS!$PBX_FREETDS$ac_delim
 TERMCAP_LIB!$TERMCAP_LIB$ac_delim
@@ -50860,6 +50067,9 @@ OPENH323_INCDIR!$OPENH323_INCDIR$ac_delim
 OPENH323_LIBDIR!$OPENH323_LIBDIR$ac_delim
 OPENH323_SUFFIX!$OPENH323_SUFFIX$ac_delim
 OPENH323_BUILD!$OPENH323_BUILD$ac_delim
+PBX_AIS!$PBX_AIS$ac_delim
+AIS_INCLUDE!$AIS_INCLUDE$ac_delim
+AIS_LIB!$AIS_LIB$ac_delim
 PBX_SPEEX_PREPROCESS!$PBX_SPEEX_PREPROCESS$ac_delim
 CONFIG_GMIME!$CONFIG_GMIME$ac_delim
 EDITLINE_LIB!$EDITLINE_LIB$ac_delim
@@ -50872,7 +50082,7 @@ CURL_CONFIG!$CURL_CONFIG$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 75; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 74; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.ac b/configure.ac
index e2892b73fa..dc0df7df08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -241,8 +241,7 @@ AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
 AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
 AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
 AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image library], [SDL_image])
-AST_EXT_LIB_SETUP([SACLM], [SAForum AIS CLM], [SaClm])
-AST_EXT_LIB_SETUP([SAEVT], [SAForum AIS EVT], [SaEvt])
+AST_EXT_LIB_SETUP([OPENAIS], [OpenAIS], [openais])
 AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
 AST_EXT_LIB_SETUP([SPEEXDSP], [Speexdsp], [speexdsp])
 AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
@@ -1351,10 +1350,31 @@ AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h])
 
 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
 
-AST_EXT_LIB_CHECK([SACLM], [SaClm], [saClmInitialize], [openais/saClm.h], [-L/usr/lib/openais])
-AST_EXT_LIB_CHECK([SACLM], [SaClm], [saClmInitialize], [openais/saClm.h])
-AST_EXT_LIB_CHECK([SAEVT], [SaEvt], [saEvtInitialize], [openais/saEvt.h], [-L/usr/lib/openais])
-AST_EXT_LIB_CHECK([SAEVT], [SaEvt], [saEvtInitialize], [openais/saEvt.h])
+# This is a bit complex... in reality, Asterisk's AIS support is dependent on finding
+# *any* implementation of AIS, not just OpenAIS. However, the configure script needs
+# to know the specifics of each possible implementation, and then represent the one
+# that was found as 'AIS'.
+
+PBX_AIS=0
+
+# OpenAIS installs its libraries into /usr/lib/openais by default, so check there
+
+AST_EXT_LIB_CHECK([OPENAIS], [SaClm], [saClmInitialize], [openais/saClm.h], [-L/usr/lib/openais])
+
+if test "${PBX_OPENAIS}" = 1; then
+   PBX_AIS=1
+   if test -n "${OPENAIS_DIR}"; then
+      AIS_INCLUDE="${OPENAIS_INCLUDE}/openais"
+      AIS_LIB="-lSaEvt ${OPENAIS_LIB}"
+   else
+      AIS_INCLUDE="-I/usr/include/openais"
+      AIS_LIB="-lSaClm -lSaEvt -L/usr/lib/openais"
+   fi
+fi
+
+AC_SUBST(PBX_AIS)
+AC_SUBST(AIS_INCLUDE)
+AC_SUBST(AIS_LIB)
 
 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
 
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 8a75fa5655..1ab0f8c851 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -539,6 +539,12 @@
 /* Define to indicate the ${OGG_DESCRIP} library version */
 #undef HAVE_OGG_VERSION
 
+/* Define this to indicate the ${OPENAIS_DESCRIP} library */
+#undef HAVE_OPENAIS
+
+/* Define to indicate the ${OPENAIS_DESCRIP} library version */
+#undef HAVE_OPENAIS_VERSION
+
 /* Define if your system has the OpenH323 libraries. */
 #undef HAVE_OPENH323
 
@@ -692,18 +698,6 @@
 /* Define RTLD_NOLOAD headers version */
 #undef HAVE_RTLD_NOLOAD_VERSION
 
-/* Define this to indicate the ${SACLM_DESCRIP} library */
-#undef HAVE_SACLM
-
-/* Define to indicate the ${SACLM_DESCRIP} library version */
-#undef HAVE_SACLM_VERSION
-
-/* Define this to indicate the ${SAEVT_DESCRIP} library */
-#undef HAVE_SAEVT
-
-/* Define to indicate the ${SAEVT_DESCRIP} library version */
-#undef HAVE_SAEVT_VERSION
-
 /* Define to 1 if your system has /sbin/launchd. */
 #undef HAVE_SBIN_LAUNCHD
 
@@ -1176,6 +1170,9 @@
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
 
 /* Define like PROTOTYPES; this can be used by system headers. */
 #undef __PROTOTYPES
diff --git a/makeopts.in b/makeopts.in
index b1ac9d4e41..8ea0fed7a8 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -154,11 +154,8 @@ SS7_LIB=@SS7_LIB@
 PWLIB_INCLUDE=@PWLIB_INCLUDE@
 PWLIB_LIB=@PWLIB_LIB@
 
-SACLM_INCLUDE=@SACLM_INCLUDE@
-SACLM_LIB=@SACLM_LIB@
-
-SAEVT_INCLUDE=@SAEVT_INCLUDE@
-SAEVT_LIB=@SAEVT_LIB@
+AIS_INCLUDE=@AIS_INCLUDE@
+AIS_LIB=@AIS_LIB@
 
 RADIUS_INCLUDE=@RADIUS_INCLUDE@
 RADIUS_LIB=@RADIUS_LIB@
diff --git a/res/Makefile b/res/Makefile
index a7ba0833fd..ecde5ad002 100644
--- a/res/Makefile
+++ b/res/Makefile
@@ -35,6 +35,8 @@ ael/ael_lex.o: ASTCFLAGS+=-I. -Iael -Wno-unused
 ael/ael.tab.o: ael/ael.tab.c ael/ael.tab.h ../include/asterisk/ael_structs.h
 ael/ael.tab.o: ASTCFLAGS+=-I. -Iael -DYYENABLE_NLS=0
 
+ais/clm.o ais/evt.o: ASTCFLAGS+=${AIS_INCLUDE}
+
 $(if $(filter res_ais,$(EMBEDDED_MODS)),modules.link,res_ais.so): ais/clm.o ais/evt.o
 
 $(if $(filter res_snmp,$(EMBEDDED_MODS)),modules.link,res_snmp.so): snmp/agent.o
diff --git a/res/ais/ais.h b/res/ais/ais.h
index 2c4c18a87b..6aaeadf15f 100644
--- a/res/ais/ais.h
+++ b/res/ais/ais.h
@@ -25,12 +25,12 @@
  * \arg http://www.openais.org/
  */
 
-#ifndef AST_AIS_H
-#define AST_AIS_H
+#ifndef RES_AIS_AIS_H
+#define RES_AIS_AIS_H
 
-#include <openais/saAis.h>
-#include <openais/saClm.h>
-#include <openais/saEvt.h>
+#include <saAis.h>
+#include <saClm.h>
+#include <saEvt.h>
 
 extern SaVersionT ais_version;
 
@@ -45,4 +45,4 @@ int ast_ais_evt_unload_module(void);
 
 const char *ais_err2str(SaAisErrorT error);
 
-#endif /* AST_AIS_H */
+#endif /* RES_AIS_AIS_H */
diff --git a/res/res_ais.c b/res/res_ais.c
index 884eb0d230..865f42458c 100644
--- a/res/res_ais.c
+++ b/res/res_ais.c
@@ -29,8 +29,7 @@
  */
 
 /*** MODULEINFO
-	<depend>SaClm</depend>
-	<depend>SaEvt</depend>
+	<depend>ais</depend>
  ***/
 
 #include "asterisk.h"
-- 
GitLab