summaryrefslogtreecommitdiffstats
path: root/ktalkd/ConfigureChecks.cmake
blob: d10b5ea478a33ac742bbc636537b85896643242c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#################################################
#
#  (C) 2010-2011 Serghei Amelian
#  serghei (DOT) amelian (AT) gmail.com
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

check_include_file( sys/types.h HAVE_SYS_TYPES_H )
check_include_file( sys/stat.h HAVE_SYS_STAT_H )
check_include_file( sys/file.h HAVE_SYS_FILE_H )
check_include_file( unistd.h HAVE_UNISTD_H )
check_include_file( utmp.h HAVE_UTMP_H )
check_include_file( utmpx.h HAVE_UTMPX_H )

check_function_exists( vsnprintf HAVE_VSNPRINTF )
check_function_exists( strerror HAVE_STRERROR )
check_symbol_exists( strerror "string.h" HAVE_STRERROR_PROTO )
check_symbol_exists( fdopen "stdio.h" HAVE_FDOPEN_PROTO )

if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
  set( PROC_FIND_USER 1 CACHE INTERNAL "" FORCE )
  set( UTMP_AND_PROC_FIND_USER 1 CACHE INTERNAL "" FORCE )
  set( ALL_PROCESSES_AND_PROC_FIND_USER 1 CACHE INTERNAL "" FORCE )
endif( )

check_c_source_compiles("
  #include <dirent.h>
  int select_process(const struct dirent *d) { return 0; }

  int main(int argc, char *argv[]) {
    struct dirent **namelist;
    (void) scandir(\"/proc\", &namelist, select_process, 0 /*no sort*/);
  }"
  SCANDIR_NEEDS_CONST
)