]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: Move mmap, geoip and maxminddb detection to geoipbackend
authorFred Morcos <fred.morcos@open-xchange.com>
Tue, 5 Sep 2023 10:01:49 +0000 (12:01 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 12:28:49 +0000 (13:28 +0100)
meson-archive/geoip/meson.build [moved from meson/geoip/meson.build with 100% similarity]
meson-archive/mmap/meson.build [moved from meson/mmap/meson.build with 100% similarity]
meson.build
modules/geoipbackend/meson.build

index 80f926c65a8dab8e5d6410fc759db41c3b11ba5a..e5a04f2380a2f524e07a1faee83de99b930e6a4d 100644 (file)
@@ -49,7 +49,6 @@ subdir('meson' / 'hardening')               # Hardening
 subdir('meson' / 'kiss-rng')                # Unsafe KISS RNG
 subdir('meson' / 'net-libs')                # Network Libraries
 subdir('meson' / 'tm-gmtoff')               # Check for tm_gmtoff field in struct tm
-subdir('meson' / 'mmap')                    # Check for mmap
 subdir('meson' / 'libsodium')               # Libsodium-based signers
 subdir('meson' / 'libdecaf')                # Libdecaf-based signers
 subdir('meson' / 'libcrypto')               # OpenSSL-based signers
@@ -132,7 +131,7 @@ all_modules = {
   'lua2':     {'deps': [],                              'exts': []},
   'remote':   {'deps': ['prog-curl', 'zeromq'],         'exts': []},
   'tinydns':  {'deps': ['cdb'],                         'exts': []},
-  'geoip':    {'deps': ['geoip'],                       'exts': []},
+  'geoip':    {'deps': [],                              'exts': []},
   'lmdb':     {'deps': ['lmdb', 'boost-serialization'], 'exts': ['lmdb-safe']},
 }
 
index f480e9e15fa48e04d49572e37fe247881e912be0..8ff436d88a40e9528ed8ab68461a8a402cc539e9 100644 (file)
@@ -1,3 +1,38 @@
+# Detect mmap
+have_mmap = cxx.has_function('mmap')
+mman_h = cxx.has_header('sys/mman.h', required: false)
+if not have_mmap
+  have_mmap = mman_h and cxx.has_function('mmap', prefix: '''#include <sys/mman.h>''')
+endif
+conf.set('HAVE_MMAP', have_mmap, description: 'GeoIP Backend: mmap')
+summary('Have <sys/mman.h>', mman_h, bool_yn: true, section: 'GeoIP Backend')
+summary('mmap', have_mmap, bool_yn: true, section: 'GeoIP Backend')
+
+# Detect GeoIP
+dep_geoip = dependency('geoip', required: false)
+conf.set('HAVE_GEOIP', dep_geoip.found(), description: 'GeoIP Backend: GeoIP Library')
+summary('GeoIP', dep_geoip.found(), bool_yn: true, section: 'GeoIP Backend')
+if dep_geoip.found()
+  summary('GeoIP Name', dep_geoip.name(), section: 'GeoIP Backend')
+  summary('GeoIP Version', dep_geoip.version(), section: 'GeoIP Backend')
+endif
+
+# Detect MaxMindDB
+dep_mmdb = dependency('libmaxminddb', required: false)
+conf.set('HAVE_MMDB', dep_mmdb.found(), description: 'GeoIP Backend: MaxMindDB Library')
+summary('MaxMindDB', dep_mmdb.found(), bool_yn: true, section: 'GeoIP Backend')
+if dep_mmdb.found()
+  summary('MaxMindDB Name', dep_mmdb.name(), section: 'GeoIP Backend')
+  summary('MaxMindDB Version', dep_mmdb.version(), section: 'GeoIP Backend')
+endif
+
+# Detect YAML-cpp
+dep_yaml_cpp = dependency('yaml-cpp', version: '>= 0.5', required: true)
+summary('YAML-CPP', dep_yaml_cpp.found(), bool_yn: true, section: 'GeoIP Backend')
+summary('YAML-CPP Name', dep_yaml_cpp.name(), section: 'GeoIP Backend')
+summary('YAML-CPP Version', dep_yaml_cpp.version(), section: 'GeoIP Backend')
+
+# Build the backend
 sources = [
   'geoipbackend.cc',
   'geoipinterface-dat.cc',
@@ -10,7 +45,7 @@ extras = [
   'geoipinterface.hh',
 ]
 
-module_deps = [deps, dep_geoip]
+module_deps = [deps, dep_geoip, dep_mmdb, dep_yaml_cpp]
 
 lib = static_library(
   module_backend_name,