Autoconf: Tidy up resolver retrans retry test
[openafs.git] / src / cf / pam-const.m4
1 dnl pam-const.m4 -- 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 Copyright 2007 Russ Allbery <rra@debian.org>
14 dnl Copyright 2007, 2008 Markus Moeller
15 dnl
16 dnl See LICENSE for licensing terms.
17 AC_DEFUN([_HEADER_PAM_CONST_SOURCE],
18 [
19 #include <security/pam_appl.h>
20 ])
21
22 AC_DEFUN([AC_HEADER_PAM_CONST],
23 [AC_CACHE_CHECK([whether PAM prefers const], [ac_cv_header_pam_const],
24 [AC_EGREP_CPP([const void \*\* *item], _HEADER_PAM_CONST_SOURCE(),
25     [ac_cv_header_pam_const=yes], [ac_cv_header_pam_const=no])])
26 AS_IF([test x"$ac_cv_header_pam_const" = xyes],
27     [ac_header_pam_const=const], [ac_header_pam_const=])
28 AC_DEFINE_UNQUOTED([PAM_CONST], [$ac_header_pam_const],
29     [Define to const if PAM uses const in pam_get_item, empty otherwise.])])