1lame_option = get_option('lame')
2lame_dep = cc.find_library('mp3lame', required : lame_option)
3have_lame = lame_dep.found()
4
5# TODO: https://github.com/mesonbuild/meson/issues/3940
6if have_lame
7  have_lame = cc.has_header_symbol('lame/lame.h', 'lame_init')
8  if not have_lame and lame_option.enabled()
9    error('Found libmp3lame but lame.h was not usable')
10  endif
11endif
12
13if have_lame
14  lame_extra_c_args = []
15  if cc.has_header_symbol('lame/lame.h', 'lame_set_VBR_quality')
16    lame_extra_c_args += ['-DHAVE_LAME_SET_VBR_QUALITY']
17  endif
18  if cc.has_header_symbol('lame/lame.h', 'MEDIUM')
19    lame_extra_c_args += ['-DGSTLAME_PRESET']
20  endif
21  lame = library('gstlame',
22    ['gstlamemp3enc.c', 'plugin.c'],
23    c_args : gst_plugins_good_args + lame_extra_c_args,
24    include_directories : [configinc, libsinc],
25    dependencies : [gstaudio_dep, lame_dep],
26    install : true,
27    install_dir : plugins_install_dir,
28  )
29  pkgconfig.generate(lame, install_dir : plugins_pkgconfig_install_dir)
30endif
31