diff options
author | Rosen Penev <rosenp@gmail.com> | 2022-09-22 22:53:18 -0700 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2022-09-23 03:39:22 -0400 |
commit | d58f4ea2003547307e1415a3120f5d0d93b06d98 (patch) | |
tree | a41a7bb6f57e0b0ac00a190daa9b86092d4843f6 /src/meson.build | |
parent | 6b31f76cd9b36b6033607181238fbf41c5b81e07 (diff) | |
download | lighttpd-git-d58f4ea2003547307e1415a3120f5d0d93b06d98.tar.gz |
[meson] turn pcre into a combo option
A single with_pcre option is better than with_pcre2 and with_pcre,
but retain with_pcre2 for compatibility with existing usage
Signed-off-by: Rosen Penev <rosenp@gmail.com>
github: #116
Diffstat (limited to 'src/meson.build')
-rw-r--r-- | src/meson.build | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/meson.build b/src/meson.build index 994f6623..1c03cb81 100644 --- a/src/meson.build +++ b/src/meson.build @@ -425,30 +425,27 @@ if get_option('with_nss') endif libpcre = [] -if get_option('with_pcre2') and not(get_option('with_pcre')) - # manual search: - # header: pcre2.h - # function: pcre_match (-lpcre2-8) - libpcre = dependency('libpcre2-8', required: false) - if libpcre.found() - libpcre = [ libpcre ] - else - libpcre = [ compiler.find_library('pcre2-8', required: true) ] +pcre = get_option('with_pcre') +if pcre == 'auto' or get_option('with_pcre2') + pcre = 'pcre2' +endif + +if pcre == 'pcre2' + libpcre = dependency('libpcre2-8', required: get_option('with_pcre') == 'pcre2' or get_option('with_pcre2')) + conf_data.set('HAVE_PCRE2_H', libpcre.found()) + conf_data.set('HAVE_PCRE', libpcre.found()) + if not libpcre.found() + pcre = 'pcre' endif - conf_data.set('HAVE_PCRE2_H', true) - conf_data.set('HAVE_PCRE', true) -elif get_option('with_pcre') - # manual search: - # header: pcre.h - # function: pcre_exec (-lpcre) - libpcre = dependency('libpcre', required: false) - if libpcre.found() - libpcre = [ libpcre ] - else - libpcre = [ compiler.find_library('pcre', required: true) ] +endif + +if pcre == 'pcre' + libpcre = dependency('libpcre', required: pcre == 'pcre') + conf_data.set('HAVE_PCRE_H', libpcre.found()) + conf_data.set('HAVE_PCRE', libpcre.found()) + if not libpcre.found() + error('Neither pcre2 nor pcre was found when with_pcre was not disabled') endif - conf_data.set('HAVE_PCRE_H', true) - conf_data.set('HAVE_PCRE', true) endif libpq = dependency('libpq', required: get_option('with_pgsql')) |