2014-11-13 01:04:59 +02:00
|
|
|
# NOTE: only add something here if it is really needed by all of kdelibs.
|
|
|
|
# Otherwise please prefer adding to the relevant config-foo.h.cmake file,
|
|
|
|
# and the CMakeLists.txt that generates it (or a separate ConfigureChecks.make file if you prefer)
|
|
|
|
# to minimize recompilations and increase modularity.
|
|
|
|
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
include(CheckCXXSymbolExists)
|
|
|
|
include(CheckFunctionExists)
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
include(CheckTypeSize)
|
2020-11-07 19:30:43 +02:00
|
|
|
include(CheckStructHasMember)
|
2014-11-13 01:04:59 +02:00
|
|
|
include(CheckCXXSourceCompiles)
|
2016-05-13 04:34:38 +00:00
|
|
|
include(CheckPrototypeDefinition)
|
2021-02-23 11:01:13 +02:00
|
|
|
include(CMakePushCheckState)
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
# The FindKDE4.cmake module sets _KDE4_PLATFORM_DEFINITIONS with
|
|
|
|
# definitions like _GNU_SOURCE that are needed on each platform.
|
|
|
|
set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
|
|
|
|
|
2020-02-19 17:12:33 +00:00
|
|
|
|
2016-04-07 03:42:53 +00:00
|
|
|
macro_bool_to_01(LIBINTL_FOUND ENABLE_NLS) # kdecore
|
2020-02-19 17:12:33 +00:00
|
|
|
macro_bool_to_01(ACL_FOUND HAVE_POSIX_ACL) # kio
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
check_include_files(fstab.h HAVE_FSTAB_H) # kio, kdecore
|
|
|
|
check_include_files(mntent.h HAVE_MNTENT_H) # solid, kio, kdecore
|
|
|
|
check_include_files(sys/param.h HAVE_SYS_PARAM_H) # various
|
|
|
|
check_include_files("stdio.h;sys/mnttab.h" HAVE_SYS_MNTTAB_H) # kio, kdecore
|
|
|
|
check_include_files(sys/mntent.h HAVE_SYS_MNTENT_H) # solid, kio, kdecore
|
|
|
|
check_include_files("sys/param.h;sys/mount.h" HAVE_SYS_MOUNT_H) # kio, kdecore
|
2021-08-26 01:44:23 +03:00
|
|
|
check_include_files(paths.h HAVE_PATHS_H) # kdecore
|
2014-11-13 01:04:59 +02:00
|
|
|
|
2020-02-09 21:45:50 +00:00
|
|
|
# TODO: separate to config-x11.h
|
2015-10-29 08:11:13 +02:00
|
|
|
macro_bool_to_01(X11_XTest_FOUND HAVE_XTEST) # kdecore
|
|
|
|
macro_bool_to_01(X11_Xcursor_FOUND HAVE_XCURSOR) # kdeui
|
|
|
|
macro_bool_to_01(X11_Xfixes_FOUND HAVE_XFIXES) # kdeui
|
2020-02-09 21:45:50 +00:00
|
|
|
macro_bool_to_01(X11_Xscreensaver_FOUND HAVE_XSCREENSAVER) # kidletime
|
|
|
|
macro_bool_to_01(X11_XSync_FOUND HAVE_XSYNC) # kidletime
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Use check_symbol_exists to check for symbols in a reliable
|
|
|
|
# cross-platform manner. It accounts for different calling
|
|
|
|
# conventions and the possibility that the symbol is defined as a
|
|
|
|
# macro. Note that some symbols require multiple includes in a
|
|
|
|
# specific order. Refer to the man page for each symbol for which a
|
|
|
|
# check is to be added to get the proper set of headers.
|
2021-06-18 22:44:10 +03:00
|
|
|
check_symbol_exists(strtoll "stdlib.h" HAVE_STRTOLL) # kioslave
|
2021-09-02 04:50:05 +03:00
|
|
|
check_symbol_exists(getgrouplist "unistd.h;grp.h" HAVE_GETGROUPLIST) # kio
|
2022-03-08 01:07:02 +02:00
|
|
|
check_symbol_exists(ttyname_r "unistd.h" HAVE_TTYNAME_R) # kinit, kpty
|
2014-11-13 01:04:59 +02:00
|
|
|
|
2021-06-18 22:44:10 +03:00
|
|
|
check_function_exists(backtrace HAVE_BACKTRACE) # kdecore, kio
|
2022-03-08 01:07:02 +02:00
|
|
|
check_function_exists(fdatasync HAVE_FDATASYNC) # kdecore
|
2021-06-18 22:44:10 +03:00
|
|
|
check_function_exists(sendfile HAVE_SENDFILE) # kioslave
|
2014-11-13 01:04:59 +02:00
|
|
|
|
2022-03-12 12:39:09 +02:00
|
|
|
check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY) # kinit
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
if (UNIX)
|
2016-05-15 02:06:56 +00:00
|
|
|
# for kpty
|
2014-11-13 01:04:59 +02:00
|
|
|
check_include_files("sys/types.h;libutil.h" HAVE_LIBUTIL_H)
|
2022-03-08 01:07:02 +02:00
|
|
|
check_include_files(termio.h HAVE_TERMIO_H)
|
|
|
|
check_include_files(pty.h HAVE_PTY_H)
|
2014-11-13 01:04:59 +02:00
|
|
|
check_include_files(sys/stropts.h HAVE_SYS_STROPTS_H)
|
2022-03-08 01:07:02 +02:00
|
|
|
check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
set(UTIL_LIBRARY)
|
2021-02-03 04:09:48 +02:00
|
|
|
|
2021-02-23 11:01:13 +02:00
|
|
|
check_symbol_exists(setutxent "utmpx.h" HAVE_UTMPX)
|
2021-01-26 17:01:48 +02:00
|
|
|
if (HAVE_UTMPX)
|
|
|
|
set(utmp utmpx)
|
2021-02-23 11:01:13 +02:00
|
|
|
else ()
|
2021-01-26 17:01:48 +02:00
|
|
|
set(utmp utmp)
|
2021-02-23 11:01:13 +02:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
cmake_reset_check_state()
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES "util")
|
|
|
|
check_symbol_exists(loginx "util.h" HAVE_UTIL_LOGINX)
|
|
|
|
cmake_reset_check_state()
|
|
|
|
check_symbol_exists(login "${utmp}.h" HAVE_LOGIN)
|
|
|
|
if (NOT HAVE_LOGIN)
|
|
|
|
cmake_reset_check_state()
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES "util")
|
|
|
|
check_symbol_exists(login "util.h" HAVE_UTIL_LOGIN)
|
|
|
|
cmake_reset_check_state()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (HAVE_UTIL_LOGINX OR HAVE_UTIL_LOGIN)
|
|
|
|
set(UTIL_LIBRARY "util")
|
|
|
|
endif ()
|
|
|
|
|
2022-03-08 01:07:02 +02:00
|
|
|
check_struct_has_member("struct ${utmp}" "ut_user" "${utmp}.h" HAVE_STRUCT_UTMP_UT_USER)
|
|
|
|
check_struct_has_member("struct ${utmp}" "ut_type" "${utmp}.h" HAVE_STRUCT_UTMP_UT_TYPE)
|
|
|
|
check_struct_has_member("struct ${utmp}" "ut_pid" "${utmp}.h" HAVE_STRUCT_UTMP_UT_PID)
|
2021-01-26 17:01:48 +02:00
|
|
|
check_struct_has_member("struct ${utmp}" "ut_session" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SESSION)
|
2022-03-08 01:07:02 +02:00
|
|
|
check_struct_has_member("struct ${utmp}" "ut_syslen" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SYSLEN)
|
|
|
|
check_struct_has_member("struct ${utmp}" "ut_id" "${utmp}.h" HAVE_STRUCT_UTMP_UT_ID)
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
check_function_exists(openpty openpty_in_libc)
|
|
|
|
if (NOT openpty_in_libc)
|
|
|
|
check_library_exists(util openpty "" openpty_in_libutil)
|
|
|
|
if (openpty_in_libutil)
|
|
|
|
set(UTIL_LIBRARY util)
|
|
|
|
endif (openpty_in_libutil)
|
|
|
|
endif (NOT openpty_in_libc)
|
|
|
|
if (openpty_in_libc OR openpty_in_libutil)
|
|
|
|
set(HAVE_OPENPTY 1)
|
|
|
|
else (openpty_in_libc OR openpty_in_libutil)
|
2021-02-23 11:01:13 +02:00
|
|
|
set(HAVE_OPENPTY 0)
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
check_function_exists(revoke HAVE_REVOKE)
|
|
|
|
endif (openpty_in_libc OR openpty_in_libutil)
|
|
|
|
|
2021-06-16 18:48:45 +03:00
|
|
|
check_function_exists(ptsname_r HAVE_PTSNAME_R)
|
2014-11-13 01:04:59 +02:00
|
|
|
endif (UNIX)
|
|
|
|
|
|
|
|
check_function_exists(getmntinfo HAVE_GETMNTINFO) # kdecore, kio
|
|
|
|
check_function_exists(setmntent HAVE_SETMNTENT) # solid, kio, kdecore
|
|
|
|
|
|
|
|
# check for existing datatypes
|
|
|
|
|
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/statvfs.h>
|
|
|
|
int main(){
|
|
|
|
struct statvfs *mntbufp;
|
|
|
|
int flags;
|
|
|
|
return getmntinfo(&mntbufp, flags);
|
|
|
|
}
|
|
|
|
" GETMNTINFO_USES_STATVFS )
|
|
|
|
|
2020-11-07 19:30:43 +02:00
|
|
|
check_struct_has_member("struct dirent" d_type dirent.h HAVE_DIRENT_D_TYPE) # kdecore, kioslave/file
|
2014-11-13 01:04:59 +02:00
|
|
|
|