diff --git a/meson.build b/meson.build index 4c54e06b1..64e2840ab 100644 --- a/meson.build +++ b/meson.build @@ -602,7 +602,7 @@ if glib_dep.found() cdata.set('HAVE_GLIB20', 1) # to match the AM_CONDITIONAL for CMake file generation endif -sndfile_dep = dependency('sndfile', version : '>= 1.0.20') +sndfile_dep = dependency('sndfile', version : '>= 1.0.20', required : get_option('sndfile')) libsystemd_dep = dependency('libsystemd', required : get_option('systemd')) if libsystemd_dep.found() @@ -641,6 +641,14 @@ if get_option('client') endif endif +# Utils dependencies + +if get_option('utils') + if not sndfile_dep.found() + error('Utils enabled but sndfile disabled or not found!') + endif +endif + # Daemon and module dependencies if get_option('daemon') @@ -815,6 +823,10 @@ if get_option('daemon') cdata.set('HAVE_GSTLDAC', 1) cdata.set('HAVE_GSTAPTX', 1) endif + + if not sndfile_dep.found() + error('Daemon enabled but sndfile disabled or not found!') + endif endif # These are required for the CMake file generation @@ -949,6 +961,7 @@ summary = [ 'Enable X11: @0@'.format(x11_dep.found()), 'Enable D-Bus: @0@'.format(dbus_dep.found()), 'Enable GLib 2: @0@'.format(glib_dep.found()), + 'Enable libsndfile: @0@'.format(sndfile_dep.found()), 'Enable systemd integration: @0@'.format(libsystemd_dep.found()), 'Enable FFTW: @0@'.format(fftw_dep.found()), 'Enable IPv6: @0@'.format(get_option('ipv6')), diff --git a/meson_options.txt b/meson_options.txt index 5797d322b..bf996d7f0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -147,6 +147,9 @@ option('oss-output', option('samplerate', type : 'feature', value : 'disabled', description : 'Optional libsamplerate support (DEPRECATED)') +option('sndfile', + type : 'feature', value : 'auto', + description : 'Optional libsndfile support') option('soxr', type : 'feature', value : 'auto', description : 'Optional SoXR support (resampling)') diff --git a/src/meson.build b/src/meson.build index 1462e259d..af47d5c58 100644 --- a/src/meson.build +++ b/src/meson.build @@ -65,7 +65,6 @@ libpulsecommon_sources = [ 'pulsecore/time-smoother_2.c', 'pulsecore/tokenizer.c', 'pulsecore/usergroup.c', - 'pulsecore/sndfile-util.c', ] libpulsecommon_headers = [ @@ -145,7 +144,6 @@ libpulsecommon_headers = [ 'pulsecore/time-smoother_2.h', 'pulsecore/tokenizer.h', 'pulsecore/usergroup.h', - 'pulsecore/sndfile-util.h', 'pulsecore/socket.h', ] @@ -160,6 +158,15 @@ if dbus_dep.found() ] endif +if sndfile_dep.found() + libpulsecommon_sources += [ + 'pulsecore/sndfile-util.c', + ] + libpulsecommon_headers += [ + 'pulsecore/sndfile-util.h', + ] +endif + if x11_dep.found() libpulsecommon_sources += [ 'pulse/client-conf-x11.c', diff --git a/src/pulsecore/meson.build b/src/pulsecore/meson.build index b30264b3a..b0fafce4b 100644 --- a/src/pulsecore/meson.build +++ b/src/pulsecore/meson.build @@ -45,8 +45,6 @@ libpulsecore_sources = [ 'sink-input.c', 'sioman.c', 'socket-server.c', - 'sound-file-stream.c', - 'sound-file.c', 'source.c', 'source-output.c', 'start-child.c', @@ -103,8 +101,6 @@ libpulsecore_headers = [ 'sink.h', 'sioman.h', 'socket-server.h', - 'sound-file-stream.h', - 'sound-file.h', 'source-output.h', 'source.h', 'start-child.h', @@ -139,6 +135,17 @@ if samplerate_dep.found() libpulsecore_sources += ['resampler/libsamplerate.c'] endif +if sndfile_dep.found() + libpulsecore_sources += [ + 'sound-file-stream.c', + 'sound-file.c', + ] + libpulsecore_headers += [ + 'sound-file-stream.h', + 'sound-file.h', + ] +endif + if soxr_dep.found() libpulsecore_sources += ['resampler/soxr.c'] endif