[Asterisk-code-review] BuildSystem: Enable OSS Audio Emulation Library in NetBSD. (asterisk[15])

Alexander Traud asteriskteam at digium.com
Tue Mar 6 13:06:51 CST 2018


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


Change subject: BuildSystem: Enable OSS Audio Emulation Library in NetBSD.
......................................................................

BuildSystem: Enable OSS Audio Emulation Library in NetBSD.

ASTERISK-27723

Change-Id: Ia230d075218551a2f53171c1b37c211914d03268
---
M configure
M configure.ac
2 files changed, 107 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/45/8445/1

diff --git a/configure b/configure
index 2456b0c..b373569 100755
--- a/configure
+++ b/configure
@@ -24328,7 +24328,8 @@
 
 
 
-# possible places for oss definitions
+# possible places for OSS definitions
+# Linux
 
 if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
    pbxlibdir=""
@@ -24385,6 +24386,104 @@
 fi
 
 
+# NetBSD: Search for a symbol like _oss_ioctl, to link its OSS Audio Emulation Library.
+
+if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
+   pbxlibdir=""
+   # if --with-OSS=DIR has been specified, use it.
+   if test "x${OSS_DIR}" != "x"; then
+      if test -d ${OSS_DIR}/lib; then
+         pbxlibdir="-L${OSS_DIR}/lib"
+      else
+         pbxlibdir="-L${OSS_DIR}"
+      fi
+   fi
+
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _oss_ioctl in -lossaudio" >&5
+$as_echo_n "checking for _oss_ioctl in -lossaudio... " >&6; }
+if ${ac_cv_lib_ossaudio__oss_ioctl+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lossaudio ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _oss_ioctl ();
+int
+main ()
+{
+return _oss_ioctl ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ossaudio__oss_ioctl=yes
+else
+  ac_cv_lib_ossaudio__oss_ioctl=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_ossaudio__oss_ioctl" >&5
+$as_echo "$ac_cv_lib_ossaudio__oss_ioctl" >&6; }
+if test "x$ac_cv_lib_ossaudio__oss_ioctl" = xyes; then :
+  AST_OSS_FOUND=yes
+else
+  AST_OSS_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+
+
+   # now check for the header.
+   if test "${AST_OSS_FOUND}" = "yes"; then
+      OSS_LIB="${pbxlibdir} -lossaudio "
+      # if --with-OSS=DIR has been specified, use it.
+      if test "x${OSS_DIR}" != "x"; then
+         OSS_INCLUDE="-I${OSS_DIR}/include"
+      fi
+      OSS_INCLUDE="${OSS_INCLUDE} "
+
+         # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_soundcard_h" = xyes; then :
+  OSS_HEADER_FOUND=1
+else
+  OSS_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+
+      if test "x${OSS_HEADER_FOUND}" = "x0" ; then
+         OSS_LIB=""
+         OSS_INCLUDE=""
+      else
+
+         PBX_OSS=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_OSS 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+# FreeBSD
 
 if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
    pbxlibdir=""
@@ -24441,6 +24540,7 @@
 fi
 
 
+# OpenBSD
 
 if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
    pbxlibdir=""
diff --git a/configure.ac b/configure.ac
index 571987c..01eea7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2191,9 +2191,14 @@
 
 AST_EXT_LIB_CHECK([BLUETOOTH], [bluetooth], [ba2str], [bluetooth/bluetooth.h])
 
-# possible places for oss definitions
+# possible places for OSS definitions
+# Linux
 AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [linux/soundcard.h])
+# NetBSD: Search for a symbol like _oss_ioctl, to link its OSS Audio Emulation Library.
+AST_EXT_LIB_CHECK([OSS], [ossaudio], [_oss_ioctl], [sys/soundcard.h])
+# FreeBSD
 AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])
+# OpenBSD
 AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
 
 PG_CONFIG=No

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia230d075218551a2f53171c1b37c211914d03268
Gerrit-Change-Number: 8445
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/20180306/9beb71cd/attachment.html>


More information about the asterisk-code-review mailing list