#load-module module-pipe-sink
])dnl
-### Automatically load driver modules depending on the hardware available
-ifelse(@HAVE_UDEV@, 1, [dnl
-.ifexists module-udev-detect@PA_SOEXT@
-load-module module-udev-detect
+### If cascaded.pa exists, then that file defines how ALSA and Bluetooth
+### devices for the user instance are loaded. Otherwise, we load the devices
+### in the normal way, i.e. by using module-udev-detect and
+### module-bluetooth-discover.
+### XXX: .ifexists is designed only for checking module existence, but when
+### using an absolute path, it happens to work for arbitrary files too.
+.ifexists /etc/pulse/cascaded.pa
+.include /etc/pulse/cascaded.pa
.else
-], [dnl
-.ifexists module-detect@PA_SOEXT@
-])dnl
-### Use the static hardware detection module (for systems that lack udev support)
-load-module module-detect
+load-module module-udev-detect
+load-module module-bluetooth-discover
.endif
### Automatically connect sink and source if JACK server is present
.fail
.endif
-ifelse(@HAVE_BLUEZ@, 1, [dnl
-### Automatically load driver modules for Bluetooth hardware
-.ifexists module-bluetooth-discover@PA_SOEXT@
-load-module module-bluetooth-discover
-.endif
-])dnl
-
ifelse(@HAVE_AF_UNIX@, 1, [dnl
### Load several protocols
#.ifexists module-esound-protocol-unix@PA_SOEXT@
.ifexists module-murphy-ivi@PA_SOEXT@
load-module module-murphy-ivi
load-module module-stream-restore restore_device=false on_hotplug=false on_rescue=false restore_volume=true preferred_stream_group=media.role.within.application.name
+
+# FIXME: This shouldn't be loaded if /etc/pulse/cascaded.pa exists, because in
+# that case the system instance is listening on the same port, so this will
+# fail. We can't use .ifexists here, because the support for nested conditional
+# sections remains unimplemented.
+.nofail
load-module module-native-protocol-tcp listen=127.0.0.1
+.fail
+
load-module module-volume-api
load-module module-audio-groups
load-module module-main-volume-policy
changequote(`[', `]')dnl Set up m4 quoting
### Automatically load driver modules depending on the hardware available
-ifelse(@HAVE_UDEV@, 1, [dnl
-.ifexists module-udev-detect@PA_SOEXT@
load-module module-udev-detect
-.else
-], @HAVE_HAL@, 1, [dnl
-.ifexists module-hal-detect@PA_SOEXT@
-load-module module-hal-detect
-.else
-], [dnl
-.ifexists module-detect@PA_SOEXT@
-])dnl
-### Use the static hardware detection module (for systems that lack udev/hal support)
-load-module module-detect
-.endif
+load-module module-bluetooth-discover
-### Load several protocols
-.ifexists module-esound-protocol-unix@PA_SOEXT@
-load-module module-esound-protocol-unix
-.endif
-load-module module-native-protocol-unix
+### Enable access for any local user
+load-module module-native-protocol-unix auth-anonymous=true
+load-module module-native-protocol-tcp listen=127.0.0.1
### Automatically restore the volume of streams and devices
load-module module-stream-restore