diff --git a/meson.build b/meson.build index 85e5fdd..ad2681f 100644 --- a/meson.build +++ b/meson.build @@ -2,6 +2,7 @@ project( 'swaylock', 'c', license: 'MIT', + meson_version: '>=0.48.0', default_options: [ 'c_std=c11', 'warning_level=2', @@ -38,9 +39,9 @@ xkbcommon = dependency('xkbcommon') cairo = dependency('cairo') pango = dependency('pango') pangocairo = dependency('pangocairo') -gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false) -libpam = cc.find_library('pam', required: get_option('pam') == 'enabled') -crypt = cc.find_library('crypt', required: false) +gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) +libpam = cc.find_library('pam', required: get_option('pam')) +crypt = cc.find_library('crypt', required: not libpam.found()) math = cc.find_library('m') git = find_program('git', required: false) @@ -139,16 +140,14 @@ sources = [ 'unicode.c', ] -if libpam.found() and get_option('pam') != 'disabled' +if libpam.found() sources += ['pam.c'] dependencies += [libpam] else warning('The swaylock binary must be setuid when compiled without libpam') warning('You must do this manually post-install: chmod a+s /path/to/swaylock') sources += ['shadow.c'] - if crypt.found() - dependencies += [crypt] - endif + dependencies += [crypt] endif swaylock_inc = include_directories('include') diff --git a/meson_options.txt b/meson_options.txt index 2e58cd9..340d211 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,11 +1,6 @@ -option('swaylock-version', type : 'string', description: 'The version string reported in `swaylock --version`.') -option( - 'pam', - type: 'combo', - choices: ['auto', 'enabled', 'disabled'], - value: 'auto', - description: 'Use PAM instead of shadow.', -) -option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.') -option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.') -option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.') +option('swaylock-version', type : 'string', description: 'The version string reported in `swaylock --version`') +option('pam', type: 'feature', value: 'auto', description: 'Use PAM instead of shadow') +option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats') +option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions') +option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions') +option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions')