[PATCH 1/1] fix building against external portaudio

AD
Adam Duskett
Mon, Nov 20, 2017 4:48 PM

currently, --with-external-pa has no effect other than giving the warning
<command-line>:0:0: warning: "PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO" redefined

os-auto.mk will set this define twice if alsa is selected:
1 due to the --with-external-pa
0 due to the --enable-sound

This is a simple fix:

  • Add linking to portaudio if --with-external-pa is defined.
  • Remove the hardcoded PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0 if alsa is selected
    and instead move it to a else clause when checking if --with-external-pa was
    passed at configure time.

Signed-off-by: Adam Duskett aduskett@gmail.com

aconfigure                  | 1 +
aconfigure.ac                | 1 +
pjmedia/build/os-auto.mak.in | 3 ++-
3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/aconfigure b/aconfigure
index aec2a28..23bf9a6 100755
--- a/aconfigure
+++ b/aconfigure
@@ -6281,6 +6281,7 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5
$as_echo "yes!!" >&6; }

  •   		  LIBS="$LIBS -lportaudio"
      		   ac_external_pa="1"
    

else
diff --git a/aconfigure.ac b/aconfigure.ac
index e9770b7..432b56a 100644
--- a/aconfigure.ac
+++ b/aconfigure.ac
@@ -675,6 +675,7 @@ AC_ARG_WITH(external-pa,
]],
[Pa_Initialize();])],
[AC_MSG_RESULT(yes!!)

  •   		  [LIBS="$LIBS -lportaudio"]
      		   ac_external_pa="1"
      		   ],
      		  [AC_MSG_ERROR([Unable to use PortAudio. If PortAudio development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
    

diff --git a/pjmedia/build/os-auto.mak.in b/pjmedia/build/os-auto.mak.in
index f998f66..5881e65 100644
--- a/pjmedia/build/os-auto.mak.in
+++ b/pjmedia/build/os-auto.mak.in
@@ -190,6 +190,8 @@ endif
ifeq (@ac_external_pa@,1)

External PA

export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1
+else
+export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0
endif

@@ -235,7 +237,6 @@ endif

ifneq ($(findstring alsa,$(AC_PJMEDIA_SND)),)
export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_ALSA=1 \

  •    -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0 \
       -DPJMEDIA_AUDIO_DEV_HAS_WMME=0
    

endif

--
2.13.6

currently, --with-external-pa has no effect other than giving the warning <command-line>:0:0: warning: "PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO" redefined os-auto.mk will set this define twice if alsa is selected: 1 due to the --with-external-pa 0 due to the --enable-sound This is a simple fix: - Add linking to portaudio if --with-external-pa is defined. - Remove the hardcoded PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0 if alsa is selected and instead move it to a else clause when checking if --with-external-pa was passed at configure time. Signed-off-by: Adam Duskett <aduskett@gmail.com> --- aconfigure | 1 + aconfigure.ac | 1 + pjmedia/build/os-auto.mak.in | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/aconfigure b/aconfigure index aec2a28..23bf9a6 100755 --- a/aconfigure +++ b/aconfigure @@ -6281,6 +6281,7 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5 $as_echo "yes!!" >&6; } + LIBS="$LIBS -lportaudio" ac_external_pa="1" else diff --git a/aconfigure.ac b/aconfigure.ac index e9770b7..432b56a 100644 --- a/aconfigure.ac +++ b/aconfigure.ac @@ -675,6 +675,7 @@ AC_ARG_WITH(external-pa, ]], [Pa_Initialize();])], [AC_MSG_RESULT(yes!!) + [LIBS="$LIBS -lportaudio"] ac_external_pa="1" ], [AC_MSG_ERROR([Unable to use PortAudio. If PortAudio development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])]) diff --git a/pjmedia/build/os-auto.mak.in b/pjmedia/build/os-auto.mak.in index f998f66..5881e65 100644 --- a/pjmedia/build/os-auto.mak.in +++ b/pjmedia/build/os-auto.mak.in @@ -190,6 +190,8 @@ endif ifeq (@ac_external_pa@,1) # External PA export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1 +else +export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0 endif # @@ -235,7 +237,6 @@ endif # ifneq ($(findstring alsa,$(AC_PJMEDIA_SND)),) export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_ALSA=1 \ - -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0 \ -DPJMEDIA_AUDIO_DEV_HAS_WMME=0 endif -- 2.13.6