mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 10:52:49 +00:00
cmake: rewrite PAM module
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c1caca5927
commit
6ea63f1018
1 changed files with 25 additions and 43 deletions
|
@ -5,41 +5,30 @@
|
||||||
# PAM_INCLUDE_DIR - the pam include directory
|
# PAM_INCLUDE_DIR - the pam include directory
|
||||||
# PAM_LIBRARIES - libpam library
|
# PAM_LIBRARIES - libpam library
|
||||||
# PAM_MESSAGE_CONST - libpam pam_message struct is const
|
# PAM_MESSAGE_CONST - libpam pam_message struct is const
|
||||||
|
#
|
||||||
|
# Copyright (c) 2021, Ivailo Monev, <xakepa10@gmail.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
|
find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h)
|
||||||
# Already in cache, be silent
|
|
||||||
set(PAM_FIND_QUIETLY TRUE)
|
|
||||||
endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
|
|
||||||
|
|
||||||
find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h pam/pam_appl.h)
|
|
||||||
find_library(PAM_LIBRARY pam)
|
find_library(PAM_LIBRARY pam)
|
||||||
find_library(DL_LIBRARY dl)
|
find_library(DL_LIBRARY dl)
|
||||||
|
|
||||||
if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
|
if(DL_LIBRARY)
|
||||||
set(PAM_FOUND TRUE)
|
set(PAM_LIBRARIES ${PAM_LIBRARY} ${DL_LIBRARY})
|
||||||
if (DL_LIBRARY)
|
else()
|
||||||
set(PAM_LIBRARIES ${PAM_LIBRARY} ${DL_LIBRARY})
|
set(PAM_LIBRARIES ${PAM_LIBRARY})
|
||||||
else (DL_LIBRARY)
|
endif()
|
||||||
set(PAM_LIBRARIES ${PAM_LIBRARY})
|
|
||||||
endif (DL_LIBRARY)
|
|
||||||
|
|
||||||
if (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
|
if(NOT DEFINED PAM_MESSAGE_CONST)
|
||||||
# darwin claims to be something special
|
include(CheckCXXSourceCompiles)
|
||||||
set(HAVE_PAM_PAM_APPL_H 1)
|
include(CMakePushCheckState)
|
||||||
endif (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
|
cmake_reset_check_state()
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES "${PAM_INCLUDE_DIR}")
|
||||||
if (NOT DEFINED PAM_MESSAGE_CONST)
|
# XXX does this work with plain c?
|
||||||
include(CheckCXXSourceCompiles)
|
check_cxx_source_compiles("
|
||||||
include(CMakePushCheckState)
|
#include <security/pam_appl.h>
|
||||||
cmake_reset_check_state()
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES "${PAM_INCLUDE_DIR}")
|
|
||||||
# XXX does this work with plain c?
|
|
||||||
check_cxx_source_compiles("
|
|
||||||
#if ${HAVE_PAM_PAM_APPL_H}+0
|
|
||||||
# include <pam/pam_appl.h>
|
|
||||||
#else
|
|
||||||
# include <security/pam_appl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int PAM_conv(
|
static int PAM_conv(
|
||||||
int num_msg,
|
int num_msg,
|
||||||
|
@ -61,19 +50,12 @@ int main(void)
|
||||||
}
|
}
|
||||||
" PAM_MESSAGE_CONST)
|
" PAM_MESSAGE_CONST)
|
||||||
cmake_reset_check_state()
|
cmake_reset_check_state()
|
||||||
endif (NOT DEFINED PAM_MESSAGE_CONST)
|
endif()
|
||||||
set(PAM_MESSAGE_CONST ${PAM_MESSAGE_CONST} CACHE BOOL "PAM expects a conversation function with const pam_message")
|
set(PAM_MESSAGE_CONST ${PAM_MESSAGE_CONST} CACHE BOOL "PAM expects a conversation function with const pam_message")
|
||||||
|
|
||||||
endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(PAM
|
||||||
if (PAM_FOUND)
|
REQUIRED_VARS PAM_LIBRARIES PAM_INCLUDE_DIR
|
||||||
if (NOT PAM_FIND_QUIETLY)
|
)
|
||||||
message(STATUS "Found PAM: ${PAM_LIBRARIES}")
|
|
||||||
endif (NOT PAM_FIND_QUIETLY)
|
|
||||||
else (PAM_FOUND)
|
|
||||||
if (PAM_FIND_REQUIRED)
|
|
||||||
message(FATAL_ERROR "PAM was not found")
|
|
||||||
endif(PAM_FIND_REQUIRED)
|
|
||||||
endif (PAM_FOUND)
|
|
||||||
|
|
||||||
mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY DL_LIBRARY PAM_MESSAGE_CONST)
|
mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY DL_LIBRARY PAM_MESSAGE_CONST)
|
||||||
|
|
Loading…
Add table
Reference in a new issue