Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / external / rra-c-util / m4 / pam-const.m4
1 dnl Determine whether PAM uses const in prototypes.
2 dnl
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.
7 dnl
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.
10 dnl
11 dnl Contributed by Markus Moeller.
12 dnl
13 dnl The canonical version of this file is maintained in the rra-c-util
14 dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
15 dnl
16 dnl Copyright 2007 Russ Allbery <rra@stanford.edu>
17 dnl Copyright 2007, 2008 Markus Moeller
18 dnl
19 dnl This file is free software; the authors give unlimited permission to copy
20 dnl and/or distribute it, with or without modifications, as long as this
21 dnl notice is preserved.
22
23 dnl Source used by RRA_HEADER_PAM_CONST.
24 AC_DEFUN([_RRA_HEADER_PAM_CONST_SOURCE],
25 [#ifdef HAVE_SECURITY_PAM_APPL_H
26 # include <security/pam_appl.h>
27 #else
28 # include <pam/pam_appl.h>
29 #endif
30 ])
31
32 AC_DEFUN([RRA_HEADER_PAM_CONST],
33 [AC_CACHE_CHECK([whether PAM prefers const], [rra_cv_header_pam_const],
34 [AC_EGREP_CPP([const void \*\* *_?item], _RRA_HEADER_PAM_CONST_SOURCE(),
35 [rra_cv_header_pam_const=yes], [rra_cv_header_pam_const=no])])
36 AS_IF([test x"$rra_cv_header_pam_const" = xyes],
37 [rra_header_pam_const=const], [rra_header_pam_const=])
38 AC_DEFINE_UNQUOTED([PAM_CONST], [$rra_header_pam_const],
39 [Define to const if PAM uses const in pam_get_item, empty otherwise.])])