$OpenBSD: patch-cmake_modules_UnixAuth_cmake,v 1.2 2014/01/28 14:49:26 zhuk Exp $
Add support for BSD auth.
--- cmake/modules/UnixAuth.cmake.orig	Thu Jan 19 00:08:40 2012
+++ cmake/modules/UnixAuth.cmake	Mon Feb  6 14:09:47 2012
@@ -35,21 +35,27 @@ check_library_exists(crypt crypt "" HAVE_CRYPT)
 if (HAVE_CRYPT)
     set(CRYPT_LIBRARIES crypt)
     check_include_files(crypt.h HAVE_CRYPT_H)
+else (HAVE_CRYPT)
+    check_function_exists(crypt found_crypt)
+    if (found_crypt)
+    	set(HAVE_CRYPT 1)
+    endif (found_crypt)
 endif (HAVE_CRYPT)
 
-if (PAM_FOUND)
-
-    set(HAVE_PAM 1)
-    set(UNIXAUTH_LIBRARIES ${PAM_LIBRARIES})
-    set(UNIXAUTH_INCLUDE_DIRS ${PAM_INCLUDE_DIR})
-
-else (PAM_FOUND)
-
-    if (HAVE_GETSPNAM)
-        set(UNIXAUTH_LIBRARIES ${SHADOW_LIBRARIES})
-    endif (HAVE_GETSPNAM)
-    if (NOT HAVE_PW_ENCRYPT)
-        set(UNIXAUTH_LIBRARIES ${UNIXAUTH_LIBRARIES} ${CRYPT_LIBRARIES})
-    endif (NOT HAVE_PW_ENCRYPT)
-
-endif (PAM_FOUND)
+check_function_exists(auth_userokay found_auth_userokay)
+if (found_auth_userokay)
+    set(HAVE_BSDAUTH 1)
+else (found_auth_userokay)
+    if (PAM_FOUND)
+        set(HAVE_PAM 1)
+        set(UNIXAUTH_LIBRARIES ${PAM_LIBRARIES})
+        set(UNIXAUTH_INCLUDE_DIRS ${PAM_INCLUDE_DIR})
+    else (PAM_FOUND)
+        if (HAVE_GETSPNAM)
+            set(UNIXAUTH_LIBRARIES ${SHADOW_LIBRARIES})
+        endif (HAVE_GETSPNAM)
+        if (NOT HAVE_PW_ENCRYPT)
+            set(UNIXAUTH_LIBRARIES ${UNIXAUTH_LIBRARIES} ${CRYPT_LIBRARIES})
+        endif (NOT HAVE_PW_ENCRYPT)
+    endif (PAM_FOUND)
+endif (found_auth_userokay)
