meson: add option to disable LDAP

Add a meson option that can be used to disable LDAP support.  This will
allow the Yocto recipe to reduce the libraries pulled in for configs
that do not use LDAP.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ida0b7f7062dd4672812eb25825d4c4bebd571901
diff --git a/meson.build b/meson.build
index 2b63b33..40ab5d9 100644
--- a/meson.build
+++ b/meson.build
@@ -82,7 +82,7 @@
 cpp = meson.get_compiler('cpp')
 
 boost_dep = dependency('boost')
-ldap_dep = cpp.find_library('ldap', required: false)
+ldap_dep = cpp.find_library('ldap', required: get_option('ldap'))
 nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
 pam_dep = dependency('pam')
 phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
@@ -187,7 +187,7 @@
     ),
 )
 
-if ldap_dep.found()
+if get_option('ldap').allowed() and ldap_dep.found()
     subdir('phosphor-ldap-config')
 endif
 
diff --git a/meson.options b/meson.options
index 44551ad..95df809 100644
--- a/meson.options
+++ b/meson.options
@@ -1,4 +1,7 @@
 option('tests', type: 'feature', description: 'Build tests', value: 'enabled')
+
+option('ldap', type: 'feature', description: 'Enable LDAP support')
+
 option(
     'root_user_mgmt',
     type: 'feature',