3 include(CheckFunctionExists)
4 include(CheckLibraryExists)
5 include(CheckIncludeFiles)
7 set(UNIXAUTH_LIBRARIES)
8 set(UNIXAUTH_INCLUDE_DIRS)
11 check_function_exists(getspnam found_getspnam)
15 macro_push_required_vars()
16 set(CMAKE_REQUIRED_LIBRARIES -lshadow)
17 check_function_exists(getspnam found_getspnam_shadow)
18 if (found_getspnam_shadow)
20 set(SHADOW_LIBRARIES shadow)
21 check_function_exists(pw_encrypt HAVE_PW_ENCRYPT) # ancient Linux shadow
22 else (found_getspnam_shadow)
23 set(CMAKE_REQUIRED_LIBRARIES -lgen) # UnixWare
24 check_function_exists(getspnam found_getspnam_gen)
25 if (found_getspnam_gen)
27 set(SHADOW_LIBRARIES gen)
28 endif (found_getspnam_gen)
29 endif (found_getspnam_shadow)
30 macro_pop_required_vars()
31 endif (found_getspnam)
34 check_library_exists(crypt crypt "" HAVE_CRYPT)
36 set(CRYPT_LIBRARIES crypt)
37 check_include_files(crypt.h HAVE_CRYPT_H)
43 set(UNIXAUTH_LIBRARIES ${PAM_LIBRARIES})
44 set(UNIXAUTH_INCLUDE_DIRS ${PAM_INCLUDE_DIR})
49 set(UNIXAUTH_LIBRARIES ${SHADOW_LIBRARIES})
51 if (NOT HAVE_PW_ENCRYPT)
52 set(UNIXAUTH_LIBRARIES ${UNIXAUTH_LIBRARIES} ${CRYPT_LIBRARIES})
53 endif (NOT HAVE_PW_ENCRYPT)