1## Copyright (C) 1996-2021 The Squid Software Foundation and contributors
2##
3## Squid software is distributed under GPLv2+ license and includes
4## contributions from numerous individuals and organizations.
5## Please see the COPYING and CONTRIBUTORS files for details.
6##
7
8dnl check whether PAM's struct pam_conv takes a const (linux-style) or
9dnl non-const (solaris-style) parametrs to the conv function.
10dnl
11dnl sets the shell variable squid_cv_pam_conv_signature to either
12dnl "linux", "solaris" or "unknown".
13dnl defines the C preprocessor macro PAM_CONV_FUNC_CONST_PARM to either
14dnl "static" (linux-style) or the empty string (solaris-style or default)
15
16AC_DEFUN([CHECK_STRUCT_PAM_CONV], [
17  AH_TEMPLATE([PAM_CONV_FUNC_CONST_PARM],
18    [Defined to const or empty depending on the style used by the OS to refer to the PAM message dialog func])
19  AC_CACHE_CHECK([for PAM conversation struct signature type],
20                  squid_cv_pam_conv_signature, [
21    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
22#include <security/pam_appl.h>
23static int
24password_conversation(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { return 0; }
25static struct pam_conv conv = { &password_conversation, 0 };
26]])], [
27   squid_cv_pam_conv_signature=linux
28], [
29    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
30#include <security/pam_appl.h>
31static int
32password_conversation(int num_msg, struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { return 0; }
33static struct pam_conv conv = { &password_conversation, 0 };
34]])], [
35  squid_cv_pam_conv_signature=solaris
36 ], [
37  squid_cv_pam_conv_signature=unknown
38  ])
39    ])
40  ])
41  case $squid_cv_pam_conv_signature in
42    linux) AC_DEFINE([PAM_CONV_FUNC_CONST_PARM],[const]) ;;
43    solaris) AC_DEFINE([PAM_CONV_FUNC_CONST_PARM],[]) ;;
44    *) AC_DEFINE([PAM_CONV_FUNC_CONST_PARM],[]) ;;
45  esac
46]) dnl CHECK_STRUCT_PAM_CONV
47
48
49