Skip to content

Commit 87c2566

Browse files
committed
Test pulseaudio installation
1 parent 0d81990 commit 87c2566

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ ifeq ($(call has, VIRTIOSND), 1)
7474
# PortAudio requires libm, yet we set -lm in the end of LDFLAGS
7575
# so that the other libraries will be benefited for no need to set
7676
# -lm separately.
77-
LDFLAGS += $(PORTAUDIOLIB) -lasound -lpthread -lrt -lpulse
77+
LDFLAGS += $(PORTAUDIOLIB) -lasound -lpthread -lrt
78+
ifneq (0, $(call check-pa))
79+
LDFLAGS += -lpulse
80+
endif
7881
CFLAGS += -Iportaudio/include
7982

8083
portaudio/Makefile:

mk/check-libs.mk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,25 @@ int main(){\n\
1010
}\n'
1111
endef
1212

13+
# Create a mininal PulseAudio program
14+
define create-pa-prog
15+
echo '\
16+
#include <pulseaudio/pulseaudio.h>\n\
17+
int main(){\n\
18+
pa_mainloop *m = NULL;\n\
19+
ma_mainloop_free(m);\n\
20+
return 0;\n\
21+
}\n'
22+
endef
23+
1324
# Check ALSA installation
1425
define check-alsa
1526
$(shell $(call create-alsa-prog) | $(CC) -x c -lasound -o /dev/null > /dev/null 2> /dev/null -
1627
&& echo $$?)
1728
endef
29+
30+
# Check PulseAudio installation
31+
define check-pa
32+
$(shell $(call create-pa-prog) | $(CC) -x c -lpulse -o /dev/null > /dev/null 2> /dev/null -
33+
&& echo $$?)
34+
endef

0 commit comments

Comments
 (0)