[Asterisk-code-review] BuildSystem: Enable Advanced Linux Sound Architecture (ALSA)... (asterisk[master])

Alexander Traud asteriskteam at digium.com
Mon Mar 5 10:13:10 CST 2018


Alexander Traud has uploaded this change for review. ( https://gerrit.asterisk.org/8433


Change subject: BuildSystem: Enable Advanced Linux Sound Architecture (ALSA) in NetBSD.
......................................................................

BuildSystem: Enable Advanced Linux Sound Architecture (ALSA) in NetBSD.

ASTERISK-27720

Change-Id: I3b21f2135f6cbfac7590ccdc2df753257f426e0b
---
M channels/chan_alsa.c
M configure
M configure.ac
3 files changed, 116 insertions(+), 11 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/33/8433/1

diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index ed7d5cf..a5dead1 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -39,6 +39,10 @@
 
 #include "asterisk.h"
 
+#include <errno.h>
+#ifndef ESTRPIPE
+#define ESTRPIPE EPIPE
+#endif
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
diff --git a/configure b/configure
index 2849fe5..e06c010 100755
--- a/configure
+++ b/configure
@@ -19583,9 +19583,106 @@
 
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_spcm_init in -lasound" >&5
-$as_echo_n "checking for snd_spcm_init in -lasound... " >&6; }
-if ${ac_cv_lib_asound_snd_spcm_init+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_pcm_open in -lasound" >&5
+$as_echo_n "checking for snd_pcm_open in -lasound... " >&6; }
+if ${ac_cv_lib_asound_snd_pcm_open+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lasound ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char snd_pcm_open ();
+int
+main ()
+{
+return snd_pcm_open ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_asound_snd_pcm_open=yes
+else
+  ac_cv_lib_asound_snd_pcm_open=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_pcm_open" >&5
+$as_echo "$ac_cv_lib_asound_snd_pcm_open" >&6; }
+if test "x$ac_cv_lib_asound_snd_pcm_open" = xyes; then :
+  AST_ALSA_FOUND=yes
+else
+  AST_ALSA_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+
+
+   # now check for the header.
+   if test "${AST_ALSA_FOUND}" = "yes"; then
+      ALSA_LIB="${pbxlibdir} -lasound "
+      # if --with-ALSA=DIR has been specified, use it.
+      if test "x${ALSA_DIR}" != "x"; then
+         ALSA_INCLUDE="-I${ALSA_DIR}/include"
+      fi
+      ALSA_INCLUDE="${ALSA_INCLUDE} "
+
+         # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ALSA_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_alsa_asoundlib_h" = xyes; then :
+  ALSA_HEADER_FOUND=1
+else
+  ALSA_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+
+      if test "x${ALSA_HEADER_FOUND}" = "x0" ; then
+         ALSA_LIB=""
+         ALSA_INCLUDE=""
+      else
+
+         PBX_ALSA=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_ALSA 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+if test "${PBX_ALSA}" = "0"; then
+
+if test "x${PBX_ALSA}" != "x1" -a "${USE_ALSA}" != "no"; then
+   pbxlibdir=""
+   # if --with-ALSA=DIR has been specified, use it.
+   if test "x${ALSA_DIR}" != "x"; then
+      if test -d ${ALSA_DIR}/lib; then
+         pbxlibdir="-L${ALSA_DIR}/lib"
+      else
+         pbxlibdir="-L${ALSA_DIR}"
+      fi
+   fi
+
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_pcm_open in -lasound" >&5
+$as_echo_n "checking for snd_pcm_open in -lasound... " >&6; }
+if ${ac_cv_lib_asound_snd_pcm_open+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -19599,27 +19696,27 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-char snd_spcm_init ();
+char snd_pcm_open ();
 int
 main ()
 {
-return snd_spcm_init ();
+return snd_pcm_open ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_asound_snd_spcm_init=yes
+  ac_cv_lib_asound_snd_pcm_open=yes
 else
-  ac_cv_lib_asound_snd_spcm_init=no
+  ac_cv_lib_asound_snd_pcm_open=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_spcm_init" >&5
-$as_echo "$ac_cv_lib_asound_snd_spcm_init" >&6; }
-if test "x$ac_cv_lib_asound_snd_spcm_init" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_pcm_open" >&5
+$as_echo "$ac_cv_lib_asound_snd_pcm_open" >&6; }
+if test "x$ac_cv_lib_asound_snd_pcm_open" = xyes; then :
   AST_ALSA_FOUND=yes
 else
   AST_ALSA_FOUND=no
@@ -19665,6 +19762,7 @@
 fi
 
 
+fi
 
 
 if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
diff --git a/configure.ac b/configure.ac
index 1bb4bc4..fcd01b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1455,7 +1455,10 @@
 
 # do the package library checks now
 
-AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
+AST_EXT_LIB_CHECK([ALSA], [asound], [snd_pcm_open], [alsa/asoundlib.h])
+if test "${PBX_ALSA}" = "0"; then
+  AST_EXT_LIB_CHECK([ALSA], [asound], [snd_pcm_open], [alsa/asoundlib.h], [-lm -ldl])
+fi
 
 AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h])
 

-- 
To view, visit https://gerrit.asterisk.org/8433
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b21f2135f6cbfac7590ccdc2df753257f426e0b
Gerrit-Change-Number: 8433
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180305/58ed2771/attachment-0001.html>


More information about the asterisk-code-review mailing list