0002-meson-Add-pam-option.patch

text/plain

Filename: 0002-meson-Add-pam-option.patch
Type: text/plain
Part: 1
Message: Re: [RFC] building postgres with meson -v8

Patch

Format: format-patch
Series: patch 0002
Subject: meson: Add pam option
File+
meson.build 25 1
meson_options.txt 3 0
From 1429482c5d3e83a89915cc332be3b0d932c939cb Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 11 May 2022 07:31:30 +0200
Subject: [PATCH 2/9] meson: Add pam option

---
 meson.build       | 26 +++++++++++++++++++++++++-
 meson_options.txt |  3 +++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 7958e8eb19..a07e25c732 100644
--- a/meson.build
+++ b/meson.build
@@ -525,6 +525,29 @@ endif
 
 
 
+###############################################################
+# Library: pam
+###############################################################
+
+pamopt = get_option('pam')
+if not pamopt.disabled()
+  pam = cc.find_library('pam', dirs: g_c_lib, required: pamopt)
+  if pam.found()
+    if cc.has_header('security/pam_appl.h', args: g_c_args, include_directories: g_c_inc)
+      cdata.set('HAVE_SECURITY_PAM_APPL_H', 1)
+    elif cc.has_header('pam/pam_appl.h', args: g_c_args, include_directories: g_c_inc)
+      cdata.set('HAVE_PAM_PAM_APPL_H', 1)
+    else
+      error('pam header not found')
+    endif
+  endif
+else
+  pam = dependency('', required: false)
+endif
+cdata.set('USE_PAM', pam.found() ? 1 : false)
+
+
+
 ###############################################################
 # Library: Tcl (for pltcl)
 # tclConfig.sh
@@ -2143,7 +2166,7 @@ backend_code = declare_dependency(
   include_directories: [postgres_inc],
   link_with: [],
   sources: generated_headers + generated_backend_headers,
-  dependencies: [os_deps, libintl, ssl, lz4, zlib, icu, icu_i18n, ldap, gssapi, libxml, zstd, systemd],
+  dependencies: [os_deps, libintl, ssl, lz4, zlib, icu, icu_i18n, ldap, pam, gssapi, libxml, zstd, systemd],
 )
 
 # Note there's intentionally no dependency on pgport/common here - we want the
@@ -2485,6 +2508,7 @@ if meson.version().version_compare('>=0.57')
       'llvm': llvm,
       'lz4': lz4,
       'nls' : libintl,
+      'pam' : pam,
       'perl': perl_dep,
       'python3': python3_dep,
       'readline': readline,
diff --git a/meson_options.txt b/meson_options.txt
index e3e36678d1..f57410fa50 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -74,6 +74,9 @@ option('lz4', type : 'feature', value: 'auto',
 option('nls', type: 'feature', value: 'auto',
   description: 'national language support')
 
+option('pam', type : 'feature', value: 'auto',
+  description: 'PAM support')
+
 option('plperl', type : 'feature', value: 'auto',
   description: 'build Perl modules (PL/Perl)')
 
-- 
2.35.1