build-sys: make sndfile optional when daemon and utils are disabled

This commit is contained in:
BtbN 2021-12-29 19:01:29 +01:00
parent 81e5bfcec3
commit ce649b0967
4 changed files with 37 additions and 7 deletions

View file

@ -602,7 +602,7 @@ if glib_dep.found()
cdata.set('HAVE_GLIB20', 1) # to match the AM_CONDITIONAL for CMake file generation cdata.set('HAVE_GLIB20', 1) # to match the AM_CONDITIONAL for CMake file generation
endif 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')) libsystemd_dep = dependency('libsystemd', required : get_option('systemd'))
if libsystemd_dep.found() if libsystemd_dep.found()
@ -641,6 +641,14 @@ if get_option('client')
endif endif
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 # Daemon and module dependencies
if get_option('daemon') if get_option('daemon')
@ -815,6 +823,10 @@ if get_option('daemon')
cdata.set('HAVE_GSTLDAC', 1) cdata.set('HAVE_GSTLDAC', 1)
cdata.set('HAVE_GSTAPTX', 1) cdata.set('HAVE_GSTAPTX', 1)
endif endif
if not sndfile_dep.found()
error('Daemon enabled but sndfile disabled or not found!')
endif
endif endif
# These are required for the CMake file generation # These are required for the CMake file generation
@ -949,6 +961,7 @@ summary = [
'Enable X11: @0@'.format(x11_dep.found()), 'Enable X11: @0@'.format(x11_dep.found()),
'Enable D-Bus: @0@'.format(dbus_dep.found()), 'Enable D-Bus: @0@'.format(dbus_dep.found()),
'Enable GLib 2: @0@'.format(glib_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 systemd integration: @0@'.format(libsystemd_dep.found()),
'Enable FFTW: @0@'.format(fftw_dep.found()), 'Enable FFTW: @0@'.format(fftw_dep.found()),
'Enable IPv6: @0@'.format(get_option('ipv6')), 'Enable IPv6: @0@'.format(get_option('ipv6')),

View file

@ -147,6 +147,9 @@ option('oss-output',
option('samplerate', option('samplerate',
type : 'feature', value : 'disabled', type : 'feature', value : 'disabled',
description : 'Optional libsamplerate support (DEPRECATED)') description : 'Optional libsamplerate support (DEPRECATED)')
option('sndfile',
type : 'feature', value : 'auto',
description : 'Optional libsndfile support')
option('soxr', option('soxr',
type : 'feature', value : 'auto', type : 'feature', value : 'auto',
description : 'Optional SoXR support (resampling)') description : 'Optional SoXR support (resampling)')

View file

@ -65,7 +65,6 @@ libpulsecommon_sources = [
'pulsecore/time-smoother_2.c', 'pulsecore/time-smoother_2.c',
'pulsecore/tokenizer.c', 'pulsecore/tokenizer.c',
'pulsecore/usergroup.c', 'pulsecore/usergroup.c',
'pulsecore/sndfile-util.c',
] ]
libpulsecommon_headers = [ libpulsecommon_headers = [
@ -145,7 +144,6 @@ libpulsecommon_headers = [
'pulsecore/time-smoother_2.h', 'pulsecore/time-smoother_2.h',
'pulsecore/tokenizer.h', 'pulsecore/tokenizer.h',
'pulsecore/usergroup.h', 'pulsecore/usergroup.h',
'pulsecore/sndfile-util.h',
'pulsecore/socket.h', 'pulsecore/socket.h',
] ]
@ -160,6 +158,15 @@ if dbus_dep.found()
] ]
endif endif
if sndfile_dep.found()
libpulsecommon_sources += [
'pulsecore/sndfile-util.c',
]
libpulsecommon_headers += [
'pulsecore/sndfile-util.h',
]
endif
if x11_dep.found() if x11_dep.found()
libpulsecommon_sources += [ libpulsecommon_sources += [
'pulse/client-conf-x11.c', 'pulse/client-conf-x11.c',

View file

@ -45,8 +45,6 @@ libpulsecore_sources = [
'sink-input.c', 'sink-input.c',
'sioman.c', 'sioman.c',
'socket-server.c', 'socket-server.c',
'sound-file-stream.c',
'sound-file.c',
'source.c', 'source.c',
'source-output.c', 'source-output.c',
'start-child.c', 'start-child.c',
@ -103,8 +101,6 @@ libpulsecore_headers = [
'sink.h', 'sink.h',
'sioman.h', 'sioman.h',
'socket-server.h', 'socket-server.h',
'sound-file-stream.h',
'sound-file.h',
'source-output.h', 'source-output.h',
'source.h', 'source.h',
'start-child.h', 'start-child.h',
@ -139,6 +135,17 @@ if samplerate_dep.found()
libpulsecore_sources += ['resampler/libsamplerate.c'] libpulsecore_sources += ['resampler/libsamplerate.c']
endif 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() if soxr_dep.found()
libpulsecore_sources += ['resampler/soxr.c'] libpulsecore_sources += ['resampler/soxr.c']
endif endif