1 # NOTE: only add something here if it is really needed by all of kdelibs.
2 # Otherwise please prefer adding to the relevant config-foo.h.cmake file,
3 # and the CMakeLists.txt that generates it (or a separate ConfigureChecks.make file if you prefer)
4 # to minimize recompilations and increase modularity.
6 include(CheckIncludeFiles)
7 include(CheckSymbolExists)
8 include(CheckFunctionExists)
9 include(CheckLibraryExists)
10 include(CheckStructHasMember)
11 include(CheckCXXSourceCompiles)
12 include(CMakePushCheckState)
14 # KatieConfig.cmake sets QT_DEFINITIONS with definitions like _GNU_SOURCE that
15 # are needed on each platform.
16 set(CMAKE_REQUIRED_DEFINITIONS ${QT_DEFINITIONS})
18 kde4_bool_to_01(LibArchive_FOUND HAVE_LIBARCHIVE) # karchive
19 kde4_bool_to_01(BZIP2_FOUND HAVE_BZIP2) # karchive
20 kde4_bool_to_01(LIBLZMA_FOUND HAVE_LIBLZMA) # karchive
21 kde4_bool_to_01(AVAHI_FOUND HAVE_AVAHI) # kdnssd
22 kde4_bool_to_01(EXIV2_FOUND HAVE_EXIV2) # kexiv2
23 kde4_bool_to_01(MPV_FOUND HAVE_MPV) # kmediaplayer
24 kde4_bool_to_01(OPENSSL_FOUND HAVE_OPENSSL) # kpasswdstore
25 kde4_bool_to_01(ACL_FOUND HAVE_POSIX_ACL) # kio
27 check_include_files(fstab.h HAVE_FSTAB_H) # kio, kdecore
28 check_include_files(mntent.h HAVE_MNTENT_H) # solid, kio, kdecore
29 check_include_files(sys/param.h HAVE_SYS_PARAM_H) # various
30 check_include_files("stdio.h;sys/mnttab.h" HAVE_SYS_MNTTAB_H) # kio, kdecore
31 check_include_files(sys/mntent.h HAVE_SYS_MNTENT_H) # solid, kio, kdecore
32 check_include_files("sys/param.h;sys/mount.h" HAVE_SYS_MOUNT_H) # kio, kdecore
33 check_include_files(paths.h HAVE_PATHS_H) # kdecore
35 # TODO: separate to config-x11.h
36 kde4_bool_to_01(X11_XTest_FOUND HAVE_XTEST) # kdecore
37 kde4_bool_to_01(X11_Xcursor_FOUND HAVE_XCURSOR) # kdeui
38 kde4_bool_to_01(X11_Xfixes_FOUND HAVE_XFIXES) # kdeui
39 kde4_bool_to_01(X11_Xscreensaver_FOUND HAVE_XSCREENSAVER) # kidletime
40 kde4_bool_to_01(X11_XSync_FOUND HAVE_XSYNC) # kidletime
43 # Use check_symbol_exists to check for symbols in a reliable
44 # cross-platform manner. It accounts for different calling
45 # conventions and the possibility that the symbol is defined as a
46 # macro. Note that some symbols require multiple includes in a
47 # specific order. Refer to the man page for each symbol for which a
48 # check is to be added to get the proper set of headers.
49 check_symbol_exists(strtoll "stdlib.h" HAVE_STRTOLL) # kioslave
50 check_symbol_exists(strmode "string.h" HAVE_STRMODE) # karchive
52 check_function_exists(backtrace HAVE_BACKTRACE) # kdecore, kio
53 check_function_exists(fdatasync HAVE_FDATASYNC) # kdecore
54 check_function_exists(arc4random_uniform HAVE_ARC4RANDOM_UNIFORM) # kdecore
55 check_function_exists(sendfile HAVE_SENDFILE) # kioslave
58 check_include_files("sys/types.h;libutil.h" HAVE_LIBUTIL_H)
59 check_include_files(termio.h HAVE_TERMIO_H)
60 check_include_files(pty.h HAVE_PTY_H)
61 check_include_files(sys/stropts.h HAVE_SYS_STROPTS_H)
62 check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
66 check_symbol_exists(setutxent "utmpx.h" HAVE_UTMPX)
73 cmake_reset_check_state()
74 set(CMAKE_REQUIRED_LIBRARIES "util")
75 check_symbol_exists(loginx "util.h" HAVE_UTIL_LOGINX)
76 cmake_reset_check_state()
77 check_symbol_exists(login "${utmp}.h" HAVE_LOGIN)
79 cmake_reset_check_state()
80 set(CMAKE_REQUIRED_LIBRARIES "util")
81 check_symbol_exists(login "util.h" HAVE_UTIL_LOGIN)
82 cmake_reset_check_state()
85 if(HAVE_UTIL_LOGINX OR HAVE_UTIL_LOGIN)
86 set(UTIL_LIBRARY "util")
89 check_struct_has_member("struct ${utmp}" "ut_user" "${utmp}.h" HAVE_STRUCT_UTMP_UT_USER)
90 check_struct_has_member("struct ${utmp}" "ut_type" "${utmp}.h" HAVE_STRUCT_UTMP_UT_TYPE)
91 check_struct_has_member("struct ${utmp}" "ut_pid" "${utmp}.h" HAVE_STRUCT_UTMP_UT_PID)
92 check_struct_has_member("struct ${utmp}" "ut_session" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SESSION)
93 check_struct_has_member("struct ${utmp}" "ut_syslen" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SYSLEN)
94 check_struct_has_member("struct ${utmp}" "ut_id" "${utmp}.h" HAVE_STRUCT_UTMP_UT_ID)
96 check_function_exists(openpty openpty_in_libc)
97 if (NOT openpty_in_libc)
98 check_library_exists(util openpty "" openpty_in_libutil)
99 if(openpty_in_libutil)
100 set(UTIL_LIBRARY util)
104 check_function_exists(ptsname_r HAVE_PTSNAME_R) # kpty
105 check_function_exists(getmntinfo HAVE_GETMNTINFO) # kdecore
106 check_function_exists(setmntent HAVE_SETMNTENT) # kdecore
108 # check for existing datatypes
110 check_cxx_source_compiles("
111 #include <sys/types.h>
112 #include <sys/statvfs.h>
114 struct statvfs *mntbufp;
116 return getmntinfo(&mntbufp, flags);
118 " GETMNTINFO_USES_STATVFS )
120 check_struct_has_member("struct dirent" d_type dirent.h HAVE_DIRENT_D_TYPE) # kdecore, kioslave/file