Detect and enable PAM authentication support
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4513 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f9d957..fb4e713 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -253,6 +253,21 @@
endif()
endif()
+# Check for PAM library
+option(ENABLE_PAM "Enable PAM authentication support" ON)
+if(ENABLE_PAM)
+ check_include_files(security/pam_appl.h HAVE_PAM_H)
+ set(CMAKE_REQUIRED_LIBRARIES -lpam)
+ check_function_exists(pam_start HAVE_PAM_START)
+ set(CMAKE_REQUIRED_LIBRARIES)
+ if(HAVE_PAM_H AND HAVE_PAM_START)
+ set(PAM_LIBS pam)
+ else()
+ set(ENABLE_PAM 0)
+ endif()
+endif()
+set(HAVE_PAM ${ENABLE_PAM})
+
# Check for socket functions
if(WIN32)
set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h ws2tcpip.h)