kdelibs/ConfigureChecks.cmake
Ivailo Monev 478ca250a2 generic: replace installation paths with KDE4_ prefixed
this is TODO from issue #9. CPack and CTest configs will not be
supported. most of the changes done to other repisitories is automated
via:

find -type f -exec sed -i -e 's|${INSTALL_DIR}|${KDE4_INSTALL_DIR}|g' \
    -e 's|${EXEC_INSTALL_PREFIX}|${KDE4_EXEC_INSTALL_PREFIX}|g' \
    -e 's|${SHARE_INSTALL_PREFIX}|${KDE4_SHARE_INSTALL_PREFIX}|g' \
    -e 's|${BIN_INSTALL_DIR}|${KDE4_BIN_INSTALL_DIR}|g' \
    -e 's|${SBIN_INSTALL_DIR}|${KDE4_SBIN_INSTALL_DIR}|g' \
    -e 's|${LIB_INSTALL_DIR}|${KDE4_LIB_INSTALL_DIR}|g' \
    -e 's|${LIBEXEC_INSTALL_DIR}|${KDE4_LIBEXEC_INSTALL_DIR}|g' \
    -e 's|${INCLUDE_INSTALL_DIR}|${KDE4_INCLUDE_INSTALL_DIR}|g' \
    -e 's|${PLUGIN_INSTALL_DIR}|${KDE4_PLUGIN_INSTALL_DIR}|g' \
    -e 's|${IMPORTS_INSTALL_DIR}|${KDE4_IMPORTS_INSTALL_DIR}|g' \
    -e 's|${CONFIG_INSTALL_DIR}|${KDE4_CONFIG_INSTALL_DIR}|g' \
    -e 's|${DATA_INSTALL_DIR}|${KDE4_DATA_INSTALL_DIR}|g' \
    -e 's|${ICON_INSTALL_DIR}|${KDE4_ICON_INSTALL_DIR}|g' \
    -e 's|${KCFG_INSTALL_DIR}|${KDE4_KCFG_INSTALL_DIR}|g' \
    -e 's|${LOCALE_INSTALL_DIR}|${KDE4_LOCALE_INSTALL_DIR}|g' \
    -e 's|${MIME_INSTALL_DIR}|${KDE4_MIME_INSTALL_DIR}|g' \
    -e 's|${SERVICES_INSTALL_DIR}|${KDE4_SERVICES_INSTALL_DIR}|g' \
    -e 's|${SERVICETYPES_INSTALL_DIR}|${KDE4_SERVICETYPES_INSTALL_DIR}|g' \
    -e 's|${SOUND_INSTALL_DIR}|${KDE4_SOUND_INSTALL_DIR}|g' \
    -e 's|${TEMPLATES_INSTALL_DIR}|${KDE4_TEMPLATES_INSTALL_DIR}|g' \
    -e 's|${WALLPAPER_INSTALL_DIR}|${KDE4_WALLPAPER_INSTALL_DIR}|g' \
    -e 's|${AUTOSTART_INSTALL_DIR}|${KDE4_AUTOSTART_INSTALL_DIR}|g' \
    -e 's|${XDG_APPS_INSTALL_DIR}|${KDE4_XDG_APPS_INSTALL_DIR}|g' \
    -e 's|${XDG_DIRECTORY_INSTALL_DIR}|${KDE4_XDG_DIRECTORY_INSTALL_DIR}|g' \
    -e 's|${XDG_MIME_INSTALL_DIR}|${KDE4_XDG_MIME_INSTALL_DIR}|g' \
    -e 's|${SYSCONF_INSTALL_DIR}|${KDE4_SYSCONF_INSTALL_DIR}|g' \
    -e 's|${MAN_INSTALL_DIR}|${KDE4_MAN_INSTALL_DIR}|g' \
    -e 's|${INFO_INSTALL_DIR}|${KDE4_INFO_INSTALL_DIR}|g' \
    -e 's|${DBUS_INTERFACES_INSTALL_DIR}|${KDE4_DBUS_INTERFACES_INSTALL_DIR}|g' \
    -e 's|${DBUS_SERVICES_INSTALL_DIR}|${KDE4_DBUS_SERVICES_INSTALL_DIR}|g' \
    -e 's|${DBUS_SYSTEM_SERVICES_INSTALL_DIR}|${KDE4_DBUS_SYSTEM_SERVICES_INSTALL_DIR}|g' \
    -e 's|${KAUTH_HELPER_PLUGIN_DIR}|${KDE4_KAUTH_HELPER_PLUGIN_DIR}|g' \
    -e 's|${KAUTH_BACKEND_PLUGIN_DIR}|${KDE4_KAUTH_BACKEND_PLUGIN_DIR}|g' {} +

note that if you execute this command you may corrupt the git repository
files so move the .git directory out of the way. you can also verify
that there are no other reference to the compatibility installation
paths via:

git grep \
    -e INSTALL_DIR \
    -e EXEC_INSTALL_PREFIX \
    -e SHARE_INSTALL_PREFIX \
    -e BIN_INSTALL_DIR \
    -e SBIN_INSTALL_DIR \
    -e LIB_INSTALL_DIR \
    -e LIBEXEC_INSTALL_DIR \
    -e INCLUDE_INSTALL_DIR \
    -e PLUGIN_INSTALL_DIR \
    -e IMPORTS_INSTALL_DIR \
    -e CONFIG_INSTALL_DIR \
    -e DATA_INSTALL_DIR \
    -e ICON_INSTALL_DIR \
    -e KCFG_INSTALL_DIR \
    -e LOCALE_INSTALL_DIR \
    -e MIME_INSTALL_DIR \
    -e SERVICES_INSTALL_DIR \
    -e SERVICETYPES_INSTALL_DIR \
    -e SOUND_INSTALL_DIR \
    -e TEMPLATES_INSTALL_DIR \
    -e WALLPAPER_INSTALL_DIR \
    -e AUTOSTART_INSTALL_DIR \
    -e XDG_APPS_INSTALL_DIR \
    -e XDG_DIRECTORY_INSTALL_DIR \
    -e XDG_MIME_INSTALL_DIR \
    -e SYSCONF_INSTALL_DIR \
    -e MAN_INSTALL_DIR \
    -e INFO_INSTALL_DIR \
    -e DBUS_INTERFACES_INSTALL_DIR \
    -e DBUS_SERVICES_INSTALL_DIR \
    -e DBUS_SYSTEM_SERVICES_INSTALL_DIR \
    -e KAUTH_HELPER_PLUGIN_DIR \
    -e KAUTH_BACKEND_PLUGIN_DIR | grep -v KDE4_

this change should make default installation Filesystem Hierarchy
Standard (FHS) compliant and packaging easier since library suffix (e.g.
64 for x86_64 hosts) will not have to be specified explicitly, it may
solve possible conflicts with installation path variables from other
projects which use custom installation paths aswell

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2020-02-08 20:46:43 +00:00

192 lines
8.8 KiB
CMake

# 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)
include(CheckStructMember)
include(CheckCXXSourceCompiles)
include(CheckPrototypeDefinition)
# 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})
macro_bool_to_01(LIBINTL_FOUND ENABLE_NLS) # kdecore
check_include_files(stdio.h HAVE_STDIO_H) # various
check_include_files(stdlib.h HAVE_STDLIB_H) # various
check_include_files(string.h HAVE_STRING_H) # various
check_include_files(strings.h HAVE_STRINGS_H) # various
check_include_files(sys/time.h TIME_WITH_SYS_TIME) # kdecore, kioslave
check_include_files(fstab.h HAVE_FSTAB_H) # kio, kdecore
check_include_files(limits.h HAVE_LIMITS_H) # various
check_include_files(mntent.h HAVE_MNTENT_H) # solid, kio, kdecore
check_include_files(sysent.h HAVE_SYSENT_H) # kdecore
check_include_files(sys/stat.h HAVE_SYS_STAT_H) # various
check_include_files(sys/types.h HAVE_SYS_TYPES_H) # various
check_include_files(sys/select.h HAVE_SYS_SELECT_H) # various
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
check_include_files(unistd.h HAVE_UNISTD_H) # various
check_include_files(stdint.h HAVE_STDINT_H) # various
check_include_files(errno.h HAVE_ERRNO_H) # various
check_include_files(sys/time.h HAVE_SYS_TIME_H) # various
check_include_files(langinfo.h HAVE_LANGINFO_H) # kdecore
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
macro_bool_to_01(X11_Xrender_FOUND HAVE_XRENDER) # kio
# 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.
check_symbol_exists(strtoll "stdlib.h" HAVE_STRTOLL) # kioslave
check_symbol_exists(S_ISSOCK "sys/stat.h" HAVE_S_ISSOCK) # config.h
check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF) # config.h
check_symbol_exists(getgrouplist "unistd.h;grp.h" HAVE_GETGROUPLIST)# kdecore/fakes.cpp
check_function_exists(backtrace HAVE_BACKTRACE) # kdecore, kio
check_function_exists(fdatasync HAVE_FDATASYNC) # kdecore, kate
check_function_exists(sendfile HAVE_SENDFILE) # kioslave
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) # kpty, kdeui, some tests
check_function_exists(getgrouplist HAVE_GETGROUPLIST) # kio
check_library_exists(volmgt volmgt_running "" HAVE_VOLMGT) # various
# Check for libresolv
# e.g. on slackware 9.1 res_init() is only a define for __res_init, so we check both, Alex
set(HAVE_RESOLV_LIBRARY FALSE) # kdecore, kdecore/network, kpac
check_library_exists(resolv res_init "" HAVE_RES_INIT_IN_RESOLV_LIBRARY)
check_library_exists(resolv __res_init "" HAVE___RES_INIT_IN_RESOLV_LIBRARY)
if (HAVE___RES_INIT_IN_RESOLV_LIBRARY OR HAVE_RES_INIT_IN_RESOLV_LIBRARY)
set(HAVE_RESOLV_LIBRARY TRUE)
endif (HAVE___RES_INIT_IN_RESOLV_LIBRARY OR HAVE_RES_INIT_IN_RESOLV_LIBRARY)
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIBRARY)
check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY)
if (UNIX)
# for kpty
check_include_files("sys/types.h;libutil.h" HAVE_LIBUTIL_H)
check_include_files(util.h HAVE_UTIL_H)
check_include_files(termios.h HAVE_TERMIOS_H)
check_include_files(termio.h HAVE_TERMIO_H)
check_include_files(pty.h HAVE_PTY_H)
check_include_files(sys/stropts.h HAVE_SYS_STROPTS_H)
check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
set(UTIL_LIBRARY)
check_library_exists(utempter addToUtmp "" HAVE_ADDTOUTEMP)
check_include_files(utempter.h HAVE_UTEMPTER_H)
if (HAVE_ADDTOUTEMP AND HAVE_UTEMPTER_H)
set(HAVE_UTEMPTER 1)
set(UTEMPTER_LIBRARY utempter)
else (HAVE_ADDTOUTEMP AND HAVE_UTEMPTER_H)
check_function_exists(login login_in_libc)
if (NOT login_in_libc)
check_library_exists(util login "" login_in_libutil)
if (login_in_libutil)
set(UTIL_LIBRARY util)
endif (login_in_libutil)
endif (NOT login_in_libc)
if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL GNU)
set (HAVE_UTMPX)
else (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL GNU)
check_function_exists(getutxent HAVE_UTMPX)
endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL GNU)
if (HAVE_UTMPX)
set(utmp utmpx)
if (login_in_libutil)
check_library_exists(util loginx "" HAVE_LOGINX)
endif (login_in_libutil)
else (HAVE_UTMPX)
set(utmp utmp)
endif (HAVE_UTMPX)
if (login_in_libc OR login_in_libutil)
set(HAVE_LOGIN 1)
else (login_in_libc OR login_in_libutil)
set(HAVE_LOGIN)
check_struct_member("struct ${utmp}" "ut_type" "${utmp}.h" HAVE_STRUCT_UTMP_UT_TYPE)
check_struct_member("struct ${utmp}" "ut_pid" "${utmp}.h" HAVE_STRUCT_UTMP_UT_PID)
check_struct_member("struct ${utmp}" "ut_session" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SESSION)
endif (login_in_libc OR login_in_libutil)
check_struct_member("struct ${utmp}" "ut_syslen" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SYSLEN)
check_struct_member("struct ${utmp}" "ut_id" "${utmp}.h" HAVE_STRUCT_UTMP_UT_ID)
endif (HAVE_ADDTOUTEMP AND HAVE_UTEMPTER_H)
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)
set(HAVE_OPENPTY)
execute_process(
COMMAND sh -c "
for ptm in ptc ptmx ptm ptym/clone; do
if test -c /dev/$ptm; then
echo /dev/$ptm
break
fi
done"
OUTPUT_VARIABLE PTM_DEVICE
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "PTY multiplexer: ${PTM_DEVICE}")
check_function_exists(revoke HAVE_REVOKE)
check_function_exists(_getpty HAVE__GETPTY)
check_function_exists(getpt HAVE_GETPT)
check_function_exists(grantpt HAVE_GRANTPT)
check_function_exists(unlockpt HAVE_UNLOCKPT)
check_function_exists(posix_openpt HAVE_POSIX_OPENPT)
endif (openpty_in_libc OR openpty_in_libutil)
check_function_exists(ptsname HAVE_PTSNAME)
check_function_exists(tcgetattr HAVE_TCGETATTR)
check_function_exists(tcsetattr HAVE_TCSETATTR)
endif (UNIX)
check_function_exists(getmntinfo HAVE_GETMNTINFO) # kdecore, kio
check_function_exists(setmntent HAVE_SETMNTENT) # solid, kio, kdecore
check_symbol_exists(res_init "sys/types.h;netinet/in.h;arpa/nameser.h;resolv.h" HAVE_RES_INIT_PROTO)
# 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 )
check_struct_member(dirent d_type dirent.h HAVE_DIRENT_D_TYPE) # kdecore, kioslave/file