1
# - Try to find the PAM libraries
2
# Once done this will define
4
# PAM_FOUND - system has pam
5
# PAM_INCLUDE_DIR - the pam include directory
6
# PAM_LIBRARIES - libpam library
8
if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
9
# Already in cache, be silent
10
set(PAM_FIND_QUIETLY TRUE)
11
endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
13
find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h pam/pam_appl.h)
14
find_library(PAM_LIBRARY pam)
15
find_library(DL_LIBRARY dl)
17
if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
20
set(PAM_LIBRARIES ${PAM_LIBRARY} ${DL_LIBRARY})
22
set(PAM_LIBRARIES ${PAM_LIBRARY})
25
if (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
26
# darwin claims to be something special
27
set(HAVE_PAM_PAM_APPL_H 1)
28
endif (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
30
if (NOT DEFINED PAM_MESSAGE_CONST)
31
include(CheckCXXSourceCompiles)
32
# XXX does this work with plain c?
33
check_cxx_source_compiles("
34
#if ${HAVE_PAM_PAM_APPL_H}+0
35
# include <pam/pam_appl.h>
37
# include <security/pam_appl.h>
42
const struct pam_message **msg, /* this is the culprit */
43
struct pam_response **resp,
51
struct pam_conv PAM_conversation = {
52
&PAM_conv, /* this bombs out if the above does not match */
59
endif (NOT DEFINED PAM_MESSAGE_CONST)
60
set(PAM_MESSAGE_CONST ${PAM_MESSAGE_CONST} CACHE BOOL "PAM expects a conversation function with const pam_message")
62
endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
65
if (NOT PAM_FIND_QUIETLY)
66
message(STATUS "Found PAM: ${PAM_LIBRARIES}")
67
endif (NOT PAM_FIND_QUIETLY)
69
if (PAM_FIND_REQUIRED)
70
message(FATAL_ERROR "PAM was not found")
71
endif(PAM_FIND_REQUIRED)
74
mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY DL_LIBRARY PAM_MESSAGE_CONST)