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