1
macro_optional_find_package(CkConnector)
2
macro_bool_to_01(CKCONNECTOR_FOUND HAVE_CKCONNECTOR)
4
# when building with libck-connector, we also need the low-level D-Bus API
5
find_package(DBus REQUIRED)
6
endif(CKCONNECTOR_FOUND)
8
macro_log_feature(CKCONNECTOR_FOUND "ck-connector" "The ConsoleKit connector library" "http://freedesktop.org/wiki/Software/ConsoleKit" FALSE "" "Provides ConsoleKit integration in KDM")
10
include(CheckCSourceRuns)
11
include(CheckStructMember)
13
check_struct_member("struct passwd" "pw_expire" "pwd.h" HAVE_STRUCT_PASSWD_PW_EXPIRE)
14
check_struct_member("struct utmp" "ut_user" "utmp.h" HAVE_STRUCT_UTMP_UT_USER)
15
check_struct_member("struct utmp" "ut_host" "utmp.h" HAVE_STRUCT_UTMP_UT_HOST)
17
check_include_files(lastlog.h HAVE_LASTLOG_H)
18
check_include_files(termio.h HAVE_TERMIO_H)
19
check_include_files(termios.h HAVE_TERMIOS_H)
20
check_include_files(sys/sockio.h HAVE_SYS_SOCKIO_H)
22
check_symbol_exists(sysinfo "sys/sysinfo.h" HAVE_SYSINFO)
23
check_symbol_exists(systeminfo "sys/systeminfo.h" HAVE_SYS_SYSTEMINFO)
24
check_symbol_exists(getdomainname "unistd.h" HAVE_GETDOMAINNAME)
26
check_function_exists(initgroups HAVE_INITGROUPS)
27
check_function_exists(mkstemp HAVE_MKSTEMP)
28
check_function_exists(getusershell HAVE_GETUSERSHELL)
36
return errno == ENOSYS;
41
check_function_exists(seteuid HAVE_SETEUID)
43
# for environ in config-kdm.h
44
check_include_files(crt_externs.h HAVE_CRT_EXTERNS_H)
45
check_function_exists(_NSGetEnviron HAVE_NSGETENVIRON)
47
find_library(UTIL_LIBRARIES util)
48
mark_as_advanced(UTIL_LIBRARIES)
50
macro_push_required_vars()
51
set(CMAKE_REQUIRED_LIBRARIES ${UTIL_LIBRARIES})
52
check_function_exists(setusercontext HAVE_SETUSERCONTEXT)
53
check_function_exists(login_getclass HAVE_LOGIN_GETCLASS)
54
check_function_exists(auth_timeok HAVE_AUTH_TIMEOK)
56
set(CMAKE_REQUIRED_LIBRARIES ${PAM_LIBRARIES})
57
check_function_exists(pam_getenvlist HAVE_PAM_GETENVLIST)
59
macro_pop_required_vars()
62
macro(define_library LIB FN)
63
set(varname ${FN}_in_${LIB})
64
string(TOUPPER ${LIB}_LIBRARIES libname)
65
check_library_exists(${LIB} ${FN} "" ${varname})
68
set(${libname} ${LIB})
70
endmacro(define_library)
72
define_library(s authenticate)
73
define_library(posix4 sched_yield)
74
define_library(socket connect)
75
define_library(resolv dn_expand)
78
check_function_exists(gethostbyname have_gethostbyname)
79
if (NOT have_gethostbyname)
80
define_library(nsl gethostbyname)
81
endif (NOT have_gethostbyname)
83
macro_push_required_vars()
84
set(CMAKE_REQUIRED_LIBRARIES ${SOCKET_LIBRARIES})
86
#include <sys/socket.h>
89
#include <sys/types.h>
96
struct sockaddr_un sa;
98
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
100
sa.sun_family = AF_UNIX;
101
strcpy(sa.sun_path, \"testsock\");
103
if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)))
105
chmod(sa.sun_path, 0);
106
setuid(getuid() + 1000);
107
if ((fd2 = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
109
connect(fd2, (struct sockaddr *)&sa, sizeof(sa));
110
return errno != EACCES;
112
" HONORS_SOCKET_PERMS)
113
macro_pop_required_vars()
115
# for genkdmconf; this is TODO
116
#if (EXISTS /etc/ttys)
118
# check_function_exists(getttyent HAVE_GETTTYENT)
119
#endif (EXISTS /etc/ttys)
121
if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD)
124
else (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD)
125
check_function_exists(getutxent HAVE_UTMPX)
126
check_function_exists(updlastlogx HAVE_LASTLOGX)
127
endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD)
130
check_function_exists(getutent have_getutent)
131
if (NOT have_getutent)
133
endif (NOT have_getutent)
134
endif (NOT HAVE_UTMPX)
135
check_function_exists(updwtmp HAVE_UPDWTMP)
137
check_function_exists(arc4random HAVE_ARC4RANDOM)
138
if (NOT HAVE_ARC4RANDOM)
139
# assume that /dev/random is non-blocking if /dev/urandom does not exist
140
if (EXISTS /dev/urandom)
141
set(DEV_RANDOM "\"/dev/urandom\"")
142
else (EXISTS /dev/urandom)
143
if (EXISTS /dev/random)
144
set(DEV_RANDOM "\"/dev/random\"")
145
endif (EXISTS /dev/random)
146
endif (EXISTS /dev/urandom)
147
endif (NOT HAVE_ARC4RANDOM)
149
option(KDE4_RPCAUTH "Use Sun's secure RPC for Xauth cookies in KDM" OFF)
151
find_path(RPC_INCLUDE_DIR rpc/rpc.h)
153
set(RPCAUTH_FOUND TRUE)
154
else (RPC_INCLUDE_DIR)
155
message(STATUS "Sun's secure RPC header was not found")
156
endif (RPC_INCLUDE_DIR)
158
mark_as_advanced(RPC_INCLUDE_DIR)
159
macro_bool_to_01(RPCAUTH_FOUND SECURE_RPC)
161
option(KDE4_KRB5AUTH "Use Sun's secure RPC for Xauth cookies in KDM" OFF)
163
find_library(KRB5_LIBRARIES krb5)
165
find_path(KRB5_INCLUDE_DIR krb5/krb5.h)
166
if (KRB5_INCLUDE_DIR)
167
set(KRB5AUTH_FOUND TRUE)
168
else (KRB5_INCLUDE_DIR)
169
message(STATUS "KDE4_KRB5AUTH requires Kerberos5 header files.
170
Due to a problem with X includes you probably have to run \"ln -s . krb5\"
171
in the directory where the krb5.h include resides to make things actually work.")
172
endif (KRB5_INCLUDE_DIR)
173
endif (KRB5_LIBRARIES)
174
mark_as_advanced(KRB5_INCLUDE_DIR KRB5_LIBRARIES)
175
macro_bool_to_01(KRB5AUTH_FOUND K5AUTH)
176
endif (KDE4_KRB5AUTH)
179
macro_push_required_vars()
180
set(CMAKE_REQUIRED_LIBRARIES ${X11_LIBRARIES})
181
check_function_exists(XdmcpWrap HASXDMAUTH)
182
macro_pop_required_vars()
183
endif (X11_Xdmcp_FOUND)
185
option(KDE4_KERBEROS4 "Compile KDM with Kerberos v4 support" OFF)
187
find_path(KRB4_INCLUDE_DIR krb.h)
188
find_library(KRB4_LIBRARY krb)
189
find_library(DES_LIBRARY des)
190
if (KRB4_INCLUDE_DIR AND KRB4_LIBRARY)
192
set(KRB4_LIBRARIES ${KRB4_LIBRARY} ${DES_LIBRARY} ${RESOLV_LIBRARIES})
193
endif (KRB4_INCLUDE_DIR AND KRB4_LIBRARY)
194
option(KDE4_AFS "Compile KDM with AFS support" OFF)
196
find_path(AFS_INCLUDE_DIR kafs.h)
197
find_library(AFS_LIBRARY kafs)
198
if (AFS_INCLUDE_DIR AND AFS_LIBRARY)
200
set(KRB4_LIBRARIES ${KRB4_LIBRARIES} ${AFS_LIBRARY})
201
endif (AFS_INCLUDE_DIR AND AFS_LIBRARY)
203
endif (KDE4_KERBEROS4)
205
option(KDE4_XDMCP "Build KDM with XDMCP support" ON)
206
if (KDE4_XDMCP AND X11_Xdmcp_FOUND)
208
endif (KDE4_XDMCP AND X11_Xdmcp_FOUND)
210
option(KDE4_KDM_XCONSOLE "Build KDM with built-in xconsole" OFF)
211
macro_bool_to_01(KDE4_KDM_XCONSOLE WITH_KDM_XCONSOLE)
213
macro_push_required_vars()
214
set(CMAKE_REQUIRED_LIBRARIES ${NSL_LIBRARIES})
215
check_function_exists(getifaddrs HAVE_GETIFADDRS)
216
macro_pop_required_vars()
217
check_function_exists(getloadavg HAVE_GETLOADAVG)
218
check_function_exists(setproctitle HAVE_SETPROCTITLE)
219
check_function_exists(strnlen HAVE_STRNLEN)
221
check_struct_member("struct sockaddr_in" "sin_len" "sys/socket.h;netinet/in.h" HAVE_STRUCT_SOCKADDR_IN_SIN_LEN)
222
check_struct_member("struct sockaddr_in6" "sin6_len" "sys/socket.h;netinet/in.h" HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN)
224
FOREACH(path /usr/local/bin /usr/bin /bin)
225
if (XBINDIR STREQUAL ${path})
227
endif (XBINDIR STREQUAL ${path})
230
set(KDM_DEF_USER_PATH "/usr/local/bin:/usr/bin:/bin:/usr/games")
231
set(KDM_DEF_SYSTEM_PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
233
set(KDM_DEF_USER_PATH "/usr/local/bin:/usr/bin:/bin:${XBINDIR}:/usr/games")
234
set(KDM_DEF_SYSTEM_PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${XBINDIR}")
235
endif (dont_add_xbin)
237
set(KDM_LIBEXEC_STRIP 0)
238
if (NOT LIBEXEC_INSTALL_DIR STREQUAL "${BIN_INSTALL_DIR}")
239
STRING(LENGTH "${BIN_INSTALL_DIR}" bidl)
240
STRING(LENGTH "${LIBEXEC_INSTALL_DIR}" lxidl)
241
set(ips "${CMAKE_INSTALL_PREFIX}/")
242
STRING(LENGTH "${ips}" ipsl)
244
if (bidl LESS ${ipsl} OR lxidl LESS ${ipsl})
246
else (bidl LESS ${ipsl} OR lxidl LESS ${ipsl})
247
STRING(SUBSTRING "${BIN_INSTALL_DIR}" 0 ${ipsl} bpr)
248
STRING(SUBSTRING "${LIBEXEC_INSTALL_DIR}" 0 ${ipsl} lpr)
249
if (NOT bpr STREQUAL "${lpr}")
251
endif (NOT bpr STREQUAL "${lpr}")
252
endif (bidl LESS ${ipsl} OR lxidl LESS ${ipsl})
254
set(KDM_LIBEXEC_STRIP -1)
255
set(KDM_LIBEXEC_SUFFIX "${LIBEXEC_INSTALL_DIR}")
257
MATH(EXPR bsfxl "${bidl} - ${ipsl}")
258
STRING(SUBSTRING "${BIN_INSTALL_DIR}" ${ipsl} ${bsfxl} bsfx)
259
STRING(REPLACE "/" ";" bsfxl "${bsfx}")
260
LIST(LENGTH bsfxl KDM_LIBEXEC_STRIP)
261
MATH(EXPR klxsfxl "${lxidl} - ${ipsl}")
262
STRING(SUBSTRING "${LIBEXEC_INSTALL_DIR}" ${ipsl} ${klxsfxl} KDM_LIBEXEC_SUFFIX)
264
endif (NOT LIBEXEC_INSTALL_DIR STREQUAL "${BIN_INSTALL_DIR}")
266
configure_file(config-kdm.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdm.h)