aboutsummaryrefslogtreecommitdiffstats
path: root/community/i3status/no-pulseaudio.patch
blob: 863d2ad824d3e79a76ab5c95101ab9e5a2396b6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
diff --git a/configure.ac b/configure.ac
index a6c31d7..11caa33 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,11 +80,24 @@
 PKG_CHECK_MODULES([CONFUSE], [libconfuse])
 PKG_CHECK_MODULES([YAJL], [yajl])
 
+AC_ARG_ENABLE(pulseaudio,
+  AS_HELP_STRING(
+    [--disable-pulseaudio],
+    [build without pulseaudio support]),
+  [ax_pulse=$enableval],
+  [ax_pulse=yes])
+AM_CONDITIONAL([PULSE], [test x$ax_pulse = xyes])
+AS_IF([test x"$ax_pulse" = x"yes"],
+      [PKG_CHECK_MODULES([PULSE], [libpulse])])
+pulse_def=0
+AS_IF([test x"$ax_pulse" = x"yes"],
+      [pulse_def=1])
+AC_DEFINE_UNQUOTED([HAS_PULSEAUDIO], [$pulse_def], [Build with pulseaudio])
+
 case $host_os in
 	linux*)
 	PKG_CHECK_MODULES([NLGENL], [libnl-genl-3.0])
 	PKG_CHECK_MODULES([ALSA], [alsa])
-	PKG_CHECK_MODULES([PULSE], [libpulse])
 	;;
 	netbsd*)
 	AC_SEARCH_LIBS([prop_string_create], [prop])
@@ -151,6 +164,7 @@
 AS_HELP_STRING([enable debug flags:], [${ax_enable_debug}])
 AS_HELP_STRING([code coverage:], [${CODE_COVERAGE_ENABLED}])
 AS_HELP_STRING([enabled sanitizers:], [${ax_enabled_sanitizers}])
+AS_HELP_STRING([pulseaudio support:], [${ax_pulse}])
 
 To compile, run:
 
diff --git a/Makefile.am b/Makefile.am
index bb251f0..c2c1c0a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,8 +68,11 @@ i3status_SOURCES = \
 	src/print_volume.c \
 	src/print_wireless_info.c \
 	src/print_file_contents.c \
-	src/process_runs.c \
-	src/pulse.c
+	src/process_runs.c
+
+if PULSE
+i3status_SOURCES += src/pulse.c
+endif
 
 dist_sysconf_DATA = \
 	i3status.conf
diff --git a/i3status.c b/i3status.c
index 0898da3..1ab8400 100644
--- a/i3status.c
+++ b/i3status.c
@@ -565,7 +565,13 @@ int main(int argc, char *argv[]) {
                 return 0;
                 break;
             case 'v':
-                printf("i3status " VERSION " © 2008 Michael Stapelberg and contributors\n");
+                printf("i3status " VERSION " © 2008 Michael Stapelberg and contributors\n"
+#if HAS_PULSEAUDIO
+                       "Built with pulseaudio support\n"
+#else
+                       "Built without pulseaudio support\n"
+#endif
+                       );
                 return 0;
                 break;
             case 0:
diff --git a/src/print_volume.c b/src/print_volume.c
index 91e8ce2..7364d47 100644
--- a/src/print_volume.c
+++ b/src/print_volume.c
@@ -86,7 +86,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *
         free(instance);
     }
 
-#if !defined(__DragonFly__) && !defined(__OpenBSD__)
+#if HAS_PULSEAUDIO
     /* Try PulseAudio first */
 
     /* If the device name has the format "pulse[:N]" where N is the