From 76c8741060bd0f5f64d9c05fd6b402e4e6e4eb66 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 21 Apr 2017 23:45:54 +0200 Subject: [PATCH] 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. --- meson.build | 26 ++++++++++++++++++++------ meson_options.txt | 4 ++-- src/journal/meson.build | 11 +++++++++++ src/resolve/meson.build | 3 +++ src/shared/meson.build | 1 + 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 4515c0098d..c808a8fc43 100644 --- a/meson.build +++ b/meson.build @@ -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, diff --git a/meson_options.txt b/meson_options.txt index 790119cd1f..d9f2f4be33 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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'], diff --git a/src/journal/meson.build b/src/journal/meson.build index 71396af529..37ec559e41 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -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, diff --git a/src/resolve/meson.build b/src/resolve/meson.build index b8feb7bb1b..46a417e766 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -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'], diff --git a/src/shared/meson.build b/src/shared/meson.build index 5f48567817..8968127d3f 100644 --- a/src/shared/meson.build +++ b/src/shared/meson.build @@ -131,6 +131,7 @@ libshared = shared_library( libcap, libacl, libcryptsetup, + libgcrypt, libiptc, libseccomp, libselinux,