Warning, /plasma/kscreenlocker/cmake/FindPAM.cmake is written in an unsupported language. File is not indexed.

0001 # - Try to find the PAM libraries
0002 # Once done this will define
0003 #
0004 #  PAM_FOUND - system has pam
0005 #  PAM_INCLUDE_DIR - the pam include directory
0006 #  PAM_LIBRARIES - libpam library
0007 
0008 if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
0009         # Already in cache, be silent
0010         set(PAM_FIND_QUIETLY TRUE)
0011 endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
0012 
0013 find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h pam/pam_appl.h)
0014 find_library(PAM_LIBRARY pam)
0015 find_library(DL_LIBRARY dl)
0016 
0017 if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
0018         set(PAM_FOUND TRUE)
0019         if (DL_LIBRARY)
0020                 set(PAM_LIBRARIES ${PAM_LIBRARY} ${DL_LIBRARY})
0021         else (DL_LIBRARY)
0022                 set(PAM_LIBRARIES ${PAM_LIBRARY})
0023         endif (DL_LIBRARY)
0024 
0025         if (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
0026                 # darwin claims to be something special
0027                 set(HAVE_PAM_PAM_APPL_H 1)
0028         endif (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
0029 
0030         if (NOT DEFINED PAM_MESSAGE_CONST)
0031                 include(CheckCXXSourceCompiles)
0032                 # XXX does this work with plain c?
0033                 check_cxx_source_compiles("
0034 #if ${HAVE_PAM_PAM_APPL_H}+0
0035 # include <pam/pam_appl.h>
0036 #else
0037 # include <security/pam_appl.h>
0038 #endif
0039 
0040 static int PAM_conv(
0041         int num_msg,
0042         const struct pam_message **msg, /* this is the culprit */
0043         struct pam_response **resp,
0044         void *ctx)
0045 {
0046         return 0;
0047 }
0048 
0049 int main(void)
0050 {
0051         struct pam_conv PAM_conversation = {
0052                 &PAM_conv, /* this bombs out if the above does not match */
0053                 0
0054         };
0055 
0056         return 0;
0057 }
0058 " PAM_MESSAGE_CONST)
0059         endif (NOT DEFINED PAM_MESSAGE_CONST)
0060         set(PAM_MESSAGE_CONST ${PAM_MESSAGE_CONST} CACHE BOOL "PAM expects a conversation function with const pam_message")
0061 
0062 endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
0063 
0064 if (PAM_FOUND)
0065         if (NOT PAM_FIND_QUIETLY)
0066                 message(STATUS "Found PAM: ${PAM_LIBRARIES}")
0067         endif (NOT PAM_FIND_QUIETLY)
0068 else (PAM_FOUND)
0069         if (PAM_FIND_REQUIRED)
0070                 message(FATAL_ERROR "PAM was not found")
0071         endif(PAM_FIND_REQUIRED)
0072 endif (PAM_FOUND)
0073 
0074 mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY DL_LIBRARY PAM_MESSAGE_CONST)