]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
BuildSystem: Enable PortAudio in NetBSD.
authorAlexander Traud <pabstraud@compuserve.com>
Tue, 6 Mar 2018 12:28:15 +0000 (13:28 +0100)
committerAlexander Traud <pabstraud@compuserve.com>
Thu, 8 Mar 2018 10:01:16 +0000 (04:01 -0600)
In NetBSD, PortAudio 1 is still the default version. PortAudio 2 can be
installed side by side but gets placed in a 'portaudio2' subdirectory. To
find PortAudio 2 even in a subdirectory, the tool pkg-config is queried via
AST_PKG_CONFIG_CHECK. For those platforms, which do not list PowerAudio 2
via pkg-config, the previous check remains and is executed thereafter.

ASTERISK-27721

Change-Id: I4175500126909ad1b181fff8e11bb4a3a6ae4fa9

configure
configure.ac
include/asterisk/autoconfig.h.in

index 2456b0ca94da59e5f1f5f62bc6c669c46177f648..4e03c5a2d99cfaea4bf78aaf723d3e3ed175c249 100755 (executable)
--- a/configure
+++ b/configure
@@ -657,6 +657,8 @@ GMIME_LIBS
 GMIME_CFLAGS
 PBX_SSL_OP_NO_TLSV1_2
 PBX_SSL_OP_NO_TLSV1_1
+PORTAUDIO_LIBS
+PORTAUDIO_CFLAGS
 PYTHONDEV_LIBS
 PYTHONDEV_CFLAGS
 PYTHONDEV_INCLUDE
@@ -1481,6 +1483,8 @@ PJPROJECT_CFLAGS
 PJPROJECT_LIBS
 PYTHONDEV_CFLAGS
 PYTHONDEV_LIBS
+PORTAUDIO_CFLAGS
+PORTAUDIO_LIBS
 GMIME_CFLAGS
 GMIME_LIBS
 GTK2_CFLAGS
@@ -2240,6 +2244,10 @@ Some influential environment variables:
               C compiler flags for PYTHONDEV, overriding pkg-config
   PYTHONDEV_LIBS
               linker flags for PYTHONDEV, overriding pkg-config
+  PORTAUDIO_CFLAGS
+              C compiler flags for PORTAUDIO, overriding pkg-config
+  PORTAUDIO_LIBS
+              linker flags for PORTAUDIO, overriding pkg-config
   GMIME_CFLAGS
               C compiler flags for GMIME, overriding pkg-config
   GMIME_LIBS  linker flags for GMIME, overriding pkg-config
 
 
 
+   if test "x${PBX_PORTAUDIO}" != "x1" -a "${USE_PORTAUDIO}" != "no"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PORTAUDIO" >&5
+$as_echo_n "checking for PORTAUDIO... " >&6; }
+
+if test -n "$PORTAUDIO_CFLAGS"; then
+    pkg_cv_PORTAUDIO_CFLAGS="$PORTAUDIO_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"portaudio-2.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "portaudio-2.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PORTAUDIO_CFLAGS=`$PKG_CONFIG --cflags "portaudio-2.0" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$PORTAUDIO_LIBS"; then
+    pkg_cv_PORTAUDIO_LIBS="$PORTAUDIO_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"portaudio-2.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "portaudio-2.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PORTAUDIO_LIBS=`$PKG_CONFIG --libs "portaudio-2.0" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               PORTAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "portaudio-2.0" 2>&1`
+        else
+               PORTAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "portaudio-2.0" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$PORTAUDIO_PKG_ERRORS" >&5
+
+
+            PBX_PORTAUDIO=0
+
+
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+            PBX_PORTAUDIO=0
+
+
+else
+       PORTAUDIO_CFLAGS=$pkg_cv_PORTAUDIO_CFLAGS
+       PORTAUDIO_LIBS=$pkg_cv_PORTAUDIO_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+            PBX_PORTAUDIO=1
+            PORTAUDIO_INCLUDE="$PORTAUDIO_CFLAGS"
+            PORTAUDIO_LIB="$PORTAUDIO_LIBS"
+
+$as_echo "#define HAVE_PORTAUDIO 1" >>confdefs.h
+
+
+fi
+   fi
+
+
 if test "x${PBX_PORTAUDIO}" != "x1" -a "${USE_PORTAUDIO}" != "no"; then
    pbxlibdir=""
    # if --with-PORTAUDIO=DIR has been specified, use it.
index 571987c0b721a532b472d6c7c22d6878d85b2c9d..592bce4ee869e4f54532a41081080a25fcf91b17 100644 (file)
@@ -2296,6 +2296,7 @@ AST_PKG_CONFIG_CHECK([PYTHONDEV], [python])
 
 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
 
+AST_PKG_CONFIG_CHECK([PORTAUDIO], [portaudio-2.0])
 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 
 AST_EXT_LIB_CHECK([PRI], [pri], [pri_connected_line_update], [libpri.h])
index aaee218c9537084dedbde00ebddda25577da6ec9..bbfac2f3b469e58572e70206b8b50a71edd48a58 100644 (file)
 /* Define to 1 if you have the popt library. */
 #undef HAVE_POPT
 
-/* Define to 1 if you have the PortAudio library. */
+/* Define if your system has the PORTAUDIO libraries. */
 #undef HAVE_PORTAUDIO
 
 /* Define to 1 if you have the `pow' function. */