meson: fix gcrypt config option

Also detect libgpg-error. Require both to be present for HAVE_CRYPT,
even though libgpg-error is only used in src/resolve. If one is available,
the other should be too, so it doesn't seem worth the trouble to make two
separate conditions.
This commit is contained in:
Michael Biebl 2017-04-21 23:45:54 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 36f0387efc
commit 76c8741060
5 changed files with 37 additions and 8 deletions

View File

@ -899,14 +899,21 @@ else
libdbus = []
endif
want_libgcrypt = get_option('libgcrypt')
if want_libgcrypt != 'false'
libgcrypt = cc.find_library('gcrypt', required : want_libgcrypt == 'true')
if libgcrypt.found()
conf.set('HAVE_LIBGCRYPT', 1)
want_gcrypt = get_option('gcrypt')
if want_gcrypt != 'false'
libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
if libgcrypt.found() and libgpg_error.found()
conf.set('HAVE_GCRYPT', 1)
else
# link to neither of the libs if one is not found
libgcrypt = []
libgpg_error = []
endif
else
libgcrypt = []
libgpg_error = []
endif
want_importd = get_option('importd')
@ -915,7 +922,7 @@ if want_importd != 'false'
conf.get('HAVE_ZLIB', 0) == 1 and
conf.get('HAVE_BZIP2', 0) == 1 and
conf.get('HAVE_XZ', 0) == 1 and
conf.get('HAVE_LIBGCRYPT', 0) == 1)
conf.get('HAVE_GCRYPT', 0) == 1)
if have_deps
conf.set('ENABLE_IMPORTD', 1)
elif want_importd == 'true'
@ -1060,6 +1067,7 @@ libsystemd = shared_library(
'-Wl,--version-script=' + libsystemd_sym_path],
link_with : [libbasic],
dependencies : [threads,
libgcrypt,
librt,
libxz,
liblz4],
@ -1305,9 +1313,12 @@ endif
if conf.get('ENABLE_RESOLVED', 0) == 1
executable('systemd-resolved',
systemd_resolved_sources,
gcrypt_util_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [threads,
libgcrypt,
libgpg_error,
libm,
libidn],
install_rpath : rootlibexecdir,
@ -1316,9 +1327,12 @@ if conf.get('ENABLE_RESOLVED', 0) == 1
exe = executable('systemd-resolve',
systemd_resolve_sources,
gcrypt_util_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [threads,
libgcrypt,
libgpg_error,
libm,
libidn],
install_rpath : rootlibexecdir,

View File

@ -197,8 +197,8 @@ option('libiptc', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'libiptc support')
option('qrencode', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'libqrencode support')
option('libgcrypt', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'libgcrypt support')
option('gcrypt', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'gcrypt support')
option('gnutls', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'gnutls support')
option('elfutils', type : 'combo', choices : ['auto', 'true', 'false'],

View File

@ -20,6 +20,17 @@ journal_internal_sources = files('''
sd-journal.c
'''.split())
if conf.get('HAVE_GCRYPT', 0) == 1
journal_internal_sources += files('''
journal-authenticate.c
journal-authenticate.h
fsprg.c
fsprg.h
'''.split())
journal_internal_sources += gcrypt_util_sources
endif
############################################################
audit_type_includes = [config_h,

View File

@ -147,6 +147,7 @@ tests += [
'src/shared/test-tables.h'],
[],
[libgcrypt,
libgpg_error,
libm],
'ENABLE_RESOLVED'],
@ -155,6 +156,7 @@ tests += [
dns_type_headers],
[],
[libgcrypt,
libgpg_error,
libm],
'ENABLE_RESOLVED'],
@ -163,6 +165,7 @@ tests += [
dns_type_headers],
[],
[libgcrypt,
libgpg_error,
libm],
'ENABLE_RESOLVED'],

View File

@ -131,6 +131,7 @@ libshared = shared_library(
libcap,
libacl,
libcryptsetup,
libgcrypt,
libiptc,
libseccomp,
libselinux,