1 dnl Determine whether PAM uses const in prototypes.
3 dnl Linux marks several PAM arguments const, including the argument to
4 dnl pam_get_item and some arguments to conversation functions, which Solaris
5 dnl doesn't. This test tries to determine which style is in use to select
6 dnl whether to declare variables const in order to avoid compiler warnings.
8 dnl Since this is just for compiler warnings, it's not horribly important if
9 dnl we guess wrong. This test is ugly, but it seems to work.
11 dnl Contributed by Markus Moeller.
13 dnl Copyright 2007 Russ Allbery <rra@stanford.edu>
14 dnl Copyright 2007, 2008 Markus Moeller
16 dnl This file is free software; the authors give unlimited permission to copy
17 dnl and/or distribute it, with or without modifications, as long as this
18 dnl notice is preserved.
20 dnl Source used by RRA_HEADER_PAM_CONST.
21 AC_DEFUN([_RRA_HEADER_PAM_CONST_SOURCE],
22 [#ifdef HAVE_SECURITY_PAM_APPL_H
23 # include <security/pam_appl.h>
25 # include <pam/pam_appl.h>
29 AC_DEFUN([RRA_HEADER_PAM_CONST],
30 [AC_CACHE_CHECK([whether PAM prefers const], [rra_cv_header_pam_const],
31 [AC_EGREP_CPP([const void \*\* *item], _RRA_HEADER_PAM_CONST_SOURCE(),
32 [rra_cv_header_pam_const=yes], [rra_cv_header_pam_const=no])])
33 AS_IF([test x"$rra_cv_header_pam_const" = xyes],
34 [rra_header_pam_const=const], [rra_header_pam_const=])
35 AC_DEFINE_UNQUOTED([PAM_CONST], [$rra_header_pam_const],
36 [Define to const if PAM uses const in pam_get_item, empty otherwise.])])