~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to cmake/modules/UnixAuth.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
find_package(PAM)
 
2
 
 
3
include(CheckFunctionExists)
 
4
include(CheckLibraryExists)
 
5
include(CheckIncludeFiles)
 
6
 
 
7
set(UNIXAUTH_LIBRARIES)
 
8
set(UNIXAUTH_INCLUDE_DIRS)
 
9
 
 
10
set(SHADOW_LIBRARIES)
 
11
check_function_exists(getspnam found_getspnam)
 
12
if (found_getspnam)
 
13
    set(HAVE_GETSPNAM 1)
 
14
else (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)
 
19
        set(HAVE_GETSPNAM 1)
 
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)
 
26
            set(HAVE_GETSPNAM 1)
 
27
            set(SHADOW_LIBRARIES gen)
 
28
        endif (found_getspnam_gen)
 
29
    endif (found_getspnam_shadow)
 
30
    macro_pop_required_vars()
 
31
endif (found_getspnam)
 
32
 
 
33
set(CRYPT_LIBRARIES)
 
34
check_library_exists(crypt crypt "" HAVE_CRYPT)
 
35
if (HAVE_CRYPT)
 
36
    set(CRYPT_LIBRARIES crypt)
 
37
    check_include_files(crypt.h HAVE_CRYPT_H)
 
38
endif (HAVE_CRYPT)
 
39
 
 
40
if (PAM_FOUND)
 
41
 
 
42
    set(HAVE_PAM 1)
 
43
    set(UNIXAUTH_LIBRARIES ${PAM_LIBRARIES})
 
44
    set(UNIXAUTH_INCLUDE_DIRS ${PAM_INCLUDE_DIR})
 
45
 
 
46
else (PAM_FOUND)
 
47
 
 
48
    if (HAVE_GETSPNAM)
 
49
        set(UNIXAUTH_LIBRARIES ${SHADOW_LIBRARIES})
 
50
    endif (HAVE_GETSPNAM)
 
51
    if (NOT HAVE_PW_ENCRYPT)
 
52
        set(UNIXAUTH_LIBRARIES ${UNIXAUTH_LIBRARIES} ${CRYPT_LIBRARIES})
 
53
    endif (NOT HAVE_PW_ENCRYPT)
 
54
 
 
55
endif (PAM_FOUND)