diff options
author | samelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-01-23 23:42:11 +0000 |
---|---|---|
committer | samelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-01-23 23:42:11 +0000 |
commit | b6fc43ccd522dfbc1e215b12adb8208c156bbd31 (patch) | |
tree | b6d14378dd6c3d2f74ea8acf515cef7f4a024cb2 /kdm/ConfigureChecks.cmake | |
parent | d53bf360906757a36588588fb0286d3b4784ffcb (diff) | |
download | tdebase-b6fc43ccd522dfbc1e215b12adb8208c156bbd31.tar.gz tdebase-b6fc43ccd522dfbc1e215b12adb8208c156bbd31.zip |
[kdebase] initial cmake support
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1216551 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdm/ConfigureChecks.cmake')
-rw-r--r-- | kdm/ConfigureChecks.cmake | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/kdm/ConfigureChecks.cmake b/kdm/ConfigureChecks.cmake new file mode 100644 index 000000000..2ac6dbd29 --- /dev/null +++ b/kdm/ConfigureChecks.cmake @@ -0,0 +1,118 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +find_library( UTIL_LIBRARY util ) + +check_function_exists( getdomainname HAVE_GETDOMAINNAME ) +check_function_exists( initgroups HAVE_INITGROUPS ) +check_function_exists( mkstemp HAVE_MKSTEMP ) +check_function_exists( setproctitle HAVE_SETPROCTITLE ) +check_function_exists( sysinfo HAVE_SYSINFO ) +check_function_exists( strnlen HAVE_STRNLEN ) +check_function_exists( getifaddrs HAVE_GETIFADDRS ) + +tde_save( CMAKE_REQUIRED_LIBRARIES ) +set( CMAKE_REQUIRED_LIBRARIES ${UTIL_LIBRARY} ) +check_function_exists( setusercontext HAVE_SETUSERCONTEXT ) +check_function_exists( getusershell HAVE_GETUSERSHELL ) +check_function_exists( login_getclass HAVE_LOGIN_GETCLASS ) +check_function_exists( auth_timeok HAVE_AUTH_TIMEOK ) +tde_restore( CMAKE_REQUIRED_LIBRARIES ) + +check_include_file( lastlog.h HAVE_LASTLOG_H ) +check_include_file( termio.h HAVE_TERMIO_H ) + +check_struct_has_member( "struct sockaddr_in" "sin_len" "sys/socket.h;netinet/in.h" HAVE_STRUCT_SOCKADDR_IN_SIN_LEN ) +check_struct_has_member( "struct passwd" "pw_expire" "pwd.h" HAVE_STRUCT_PASSWD_PW_EXPIRE ) +check_struct_has_member( "struct utmp" "ut_user" "utmp.h" HAVE_STRUCT_UTMP_UT_USER ) + +check_c_source_runs( " + #include <errno.h> + #include <unistd.h> + int main() + { + setlogin(0); + return errno == ENOSYS; + } +" HAVE_SETLOGIN ) + +check_c_source_runs( " + #include <sys/socket.h> + #include <sys/un.h> + #include <sys/stat.h> + #include <sys/types.h> + #include <string.h> + #include <unistd.h> + #include <errno.h> + int main() + { + int fd, fd2; + struct sockaddr_un sa; + + if((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) + return 2; + sa.sun_family = AF_UNIX; + strcpy(sa.sun_path, \"testsock\"); + unlink(sa.sun_path); + if(bind(fd, (struct sockaddr *)&sa, sizeof(sa))) + return 2; + chmod(sa.sun_path, 0); + setuid(getuid() + 1000); + if((fd2 = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) + return 2; + connect(fd2, (struct sockaddr *)&sa, sizeof(sa)); + return errno != EACCES; + } +" HONORS_SOCKET_PERMS ) + +if( CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD ) + unset( HAVE_UTMPX ) + unset( HAVE_LASTLOGX ) +else( ) + check_function_exists( getutxent HAVE_UTMPX ) + check_function_exists( updlastlogx HAVE_LASTLOGX ) +endif( ) + +unset( BSD_UTMP ) +if( NOT HAVE_UTMPX ) + check_function_exists( getutent have_getutent ) + if( NOT have_getutent ) + set( BSD_UTMP 1 ) + endif( ) +endif( ) + +check_function_exists( arc4random HAVE_ARC4RANDOM ) +if( NOT HAVE_ARC4RANDOM ) + # assume that /dev/random is non-blocking if /dev/urandom does not exist + if( EXISTS /dev/urandom ) + set( DEV_RANDOM "/dev/urandom" CACHE INTERNAL "" FORCE ) + elseif( EXISTS /dev/random ) + set( DEV_RANDOM "/dev/random" CACHE INTERNAL "" FORCE ) + endif( ) +endif (NOT HAVE_ARC4RANDOM) + +# Xau +pkg_search_module( XAU xau ) +if( NOT XAU_FOUND ) + tde_message_fatal( "Xau are required, but not found on your system" ) +endif() + + +if( WITH_PAM ) + + set( USE_PAM 1 CACHE INTERNAL "" FORCE ) + +elseif( WITH_SHADOW ) + + set( HAVE_SHADOW 1 CACHE INTERNAL "" FORCE ) + set( USESHADOW 1 CACHE INTERNAL "" FORCE ) + +endif( ) |