TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1334 lines
44 KiB

  1. #################################################
  2. #
  3. # (C) 2010-2011 Serghei Amelian
  4. # serghei (DOT) amelian (AT) gmail.com
  5. #
  6. # Improvements and feedback are welcome
  7. #
  8. # This file is released under GPL >= 2
  9. #
  10. #################################################
  11. cmake_minimum_required( VERSION 2.8 )
  12. ##### general package setup #####################
  13. project( tdelibs )
  14. set( PACKAGE tdelibs )
  15. set( VERSION R14.1.0 )
  16. ##### include essential cmake modules ###########
  17. include( FindPkgConfig )
  18. include( CheckIncludeFile )
  19. include( CheckSymbolExists )
  20. include( CheckFunctionExists )
  21. include( CheckCSourceCompiles )
  22. include( CheckCXXSourceCompiles )
  23. include( CheckTypeSize )
  24. include( CheckCSourceRuns )
  25. include( CheckLibraryExists )
  26. ##### include our cmake modules #################
  27. set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
  28. include( TDEMacros )
  29. include( TDESetupPaths )
  30. ##### setup and find essential stuff ############
  31. tde_setup_paths( )
  32. tde_setup_architecture_flags( )
  33. enable_testing( )
  34. find_package( TQt )
  35. list( APPEND TDECORE_LIBRARY_DIRS ${TQT_LIBRARY_DIRS} )
  36. ##### add apidox targets ############
  37. add_custom_target(apidox
  38. COMMAND "./generate_apidox" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${HTML_INSTALL_DIR}" "/usr/share/tqt3/doc/html"
  39. WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake/")
  40. add_custom_target(install-apidox
  41. COMMAND "./install_apidox" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${HTML_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}"
  42. WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake/")
  43. ##### user requested OPTIONs ####################
  44. OPTION( WITH_ALL_OPTIONS "Enable all OPTIONal support" OFF )
  45. OPTION( TDE_MALLOC "Use own malloc implementation" OFF )
  46. OPTION( TDE_MALLOC_DEBUG "Enable debugging in fast malloc" OFF )
  47. OPTION( TDE_MALLOC_FULL "Make alloc as fast as possible" OFF )
  48. OPTION( WITH_ARTS "Build with aRts" ON )
  49. OPTION( WITH_ALSA "Enable ALSA support" ON )
  50. OPTION( WITH_LIBART "Enable libart support (for SVG icons)" ${WITH_ALL_OPTIONS} )
  51. OPTION( WITH_LIBIDN "Enable support for libidn" ${WITH_ALL_OPTIONS} )
  52. OPTION( WITH_SSL "Enable support for SSL" ON )
  53. OPTION( WITH_CUPS "Enable CUPS support" ON )
  54. OPTION( WITH_LUA "Enable LUA support" ${WITH_ALL_OPTIONS} )
  55. OPTION( WITH_TIFF "Enable tiff support" ${WITH_ALL_OPTIONS} )
  56. OPTION( WITH_JASPER "Enable jasper (jpeg2k) support" ${WITH_ALL_OPTIONS} )
  57. OPTION( WITH_OPENEXR "Enable openexr support" ${WITH_ALL_OPTIONS} )
  58. OPTION( WITH_UTEMPTER "Use utempter for utmp management" ${WITH_ALL_OPTIONS} )
  59. OPTION( WITH_AVAHI "Enable AVAHI support" ${WITH_ALL_OPTIONS} )
  60. OPTION( WITH_ELFICON "Enable ELF embedded icon support" ${WITH_ALL_OPTIONS} )
  61. OPTION( WITH_PCRE "Enable pcre regex support for kjs" ON )
  62. OPTION( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
  63. OPTION( WITH_INOTIFY "Enable inotify support for tdeio" ON )
  64. OPTION( WITH_GAMIN "Enable FAM/GAMIN support" ${WITH_ALL_OPTIONS} )
  65. OPTION( WITH_TDEHWLIB "Enable TDE hwlib globally" ON )
  66. OPTION( WITH_TDEHWLIB_DAEMONS "Enable daemons for TDE hwlib" ${WITH_TDEHWLIB} )
  67. OPTION( WITH_HAL "Enable HAL support" OFF )
  68. OPTION( WITH_DEVKITPOWER "Enable DeviceKit Power support" OFF )
  69. OPTION( WITH_LOGINDPOWER "Enable Logind/Systemd Power support" OFF )
  70. OPTION( WITH_UPOWER "Enable uPower support" ${WITH_ALL_OPTIONS} )
  71. OPTION( WITH_UDISKS "Enable uDisks support" ${WITH_ALL_OPTIONS} )
  72. OPTION( WITH_UDISKS2 "Enable uDisks2 support" ${WITH_ALL_OPTIONS} )
  73. OPTION( WITH_UDEVIL "Enable udevil support" ${WITH_ALL_OPTIONS} )
  74. OPTION( WITH_CONSOLEKIT "Enable ConsoleKit support" ${WITH_ALL_OPTIONS} )
  75. OPTION( WITH_NETWORK_MANAGER_BACKEND "Enable network-manager support" OFF )
  76. OPTION( WITH_SUDO_TDESU_BACKEND "Use sudo as backend for tdesu (default is su)" OFF )
  77. OPTION( WITH_OLD_XDG_STD "Use the pre R14.0.0 XDG standard where both TDE and KDE are recognized in desktop files" OFF )
  78. OPTION( WITH_PCSC "Enable PC/SC SmartCard support" ${WITH_ALL_OPTIONS} )
  79. OPTION( WITH_PKCS "Enable PKCS support" ${WITH_ALL_OPTIONS} )
  80. OPTION( WITH_CRYPTSETUP "Enable cryptsetup support" ${WITH_ALL_OPTIONS} )
  81. OPTION( WITH_LZMA "Enable support for LZMA/XZ" ${WITH_ALL_OPTIONS} )
  82. OPTION( WITH_LIBBFD "Enable pretty backtraces with libbfd from GNU binutils" OFF )
  83. OPTION( WITH_XRANDR "Build the tderandr library" ON )
  84. OPTION( WITH_XCOMPOSITE "Enable xcomposite support" ON )
  85. OPTION( WITH_MITSHM "Use MIT-SHM for pixmap loading/saving" ${WITH_ALL_OPTIONS} )
  86. OPTION( WITH_KDE4_MENU_SUFFIX "Add [KDE4] tag to KDE4 menu items" OFF )
  87. OPTION( WITH_ASPELL "Enable aspell support" ${WITH_ALL_OPTIONS} )
  88. OPTION( WITH_HSPELL "Enable hspell support" ${WITH_ALL_OPTIONS} )
  89. OPTION( WITH_TDEICONLOADER_DEBUG "Enable debugging in TDEIconLoader class" OFF )
  90. ##### set PKG_CONFIG_PATH #######################
  91. set( ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:${PKGCONFIG_INSTALL_DIR}:${LIB_INSTALL_DIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}" )
  92. ##### check for CPU architecture ################
  93. ### FIXME fast malloc is also available on x86_64 architecture?
  94. if( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i?86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" )
  95. set( TDE_MALLOC_X86 1 )
  96. message( STATUS "Found x86 architecture" )
  97. else( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i?86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" )
  98. if( TDE_MALLOC )
  99. message( FATAL_ERROR "\nKDE fast malloc is available only on x86 architecture" )
  100. endif( TDE_MALLOC )
  101. endif( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i?86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" )
  102. ##### check for operating system ################
  103. if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
  104. set( TDEINIT_SETUID 1 )
  105. set( TDEINIT_OOM_PROTECT 1 )
  106. endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
  107. ##### check for compiler capabilities ###########
  108. include( CheckCXXCompilerFlag )
  109. check_cxx_compiler_flag( -Woverloaded-virtual WOVERLOADED_VIRTUAL )
  110. if( WOVERLOADED_VIRTUAL )
  111. set( WOVERLOADED_VIRTUAL -Woverloaded-virtual )
  112. endif( WOVERLOADED_VIRTUAL )
  113. check_cxx_compiler_flag( -fno-builtin NO_BUILTIN )
  114. if( NO_BUILTIN )
  115. endif( NO_BUILTIN )
  116. ##### system checks #############################
  117. include(TestBigEndian)
  118. test_big_endian(WORDS_BIGENDIAN)
  119. tde_save_and_set( CMAKE_REQUIRED_INCLUDES ${CMAKE_SOURCE_DIR}/libltdl )
  120. check_include_file( "ltdl.h" HAVE_LTDL_H )
  121. if( NOT HAVE_LTDL_H )
  122. tde_message_fatal( "ltdl.h is required, but not found on your system" )
  123. endif( )
  124. tde_restore( CMAKE_REQUIRED_INCLUDES )
  125. check_include_file( "alloca.h" HAVE_ALLOCA_H )
  126. check_include_file( "arpa/nameser8_compat.h" HAVE_ARPA_NAMESER8_COMPAT_H )
  127. check_include_file( "awe_voice.h" HAVE_AWE_VOICE_H )
  128. check_include_file( "Carbon/Carbon.h" HAVE_CARBON_CARBON_H )
  129. check_include_file( "crt_externs.h" HAVE_CRT_EXTERNS_H )
  130. check_include_file( "ctype.h" HAVE_CTYPE_H )
  131. check_include_file( "dirent.h" HAVE_DIRENT_H )
  132. check_include_file( "dld.h" HAVE_DLD_H )
  133. check_include_file( "dlfcn.h" HAVE_DLFCN_H )
  134. check_include_file( "dl.h" HAVE_DL_H )
  135. check_include_file( "float.h" HAVE_FLOAT_H )
  136. check_include_file( "fstab.h" HAVE_FSTAB_H )
  137. check_include_file( "ieeefp.h" HAVE_IEEEFP_H )
  138. check_include_file( "inttypes.h" HAVE_INTTYPES_H )
  139. check_include_file( "libutil.h" HAVE_LIBUTIL_H )
  140. check_include_file( "limits.h" HAVE_LIMITS_H )
  141. check_include_file( "linux/awe_voice.h" HAVE_LINUX_AWE_VOICE_H )
  142. check_include_file( "locale.h" HAVE_LOCALE_H )
  143. check_include_file( "machine/soundcard.h" HAVE_MACHINE_SOUNDCARD_H )
  144. check_include_file( "malloc.h" HAVE_MALLOC_H )
  145. check_include_file( "memory.h" HAVE_MEMORY_H )
  146. check_include_file( "mntent.h" HAVE_MNTENT_H )
  147. check_include_file( "ndir.h" HAVE_NDIR_H )
  148. check_include_file( "netinet/in.h" HAVE_NETINET_IN_H )
  149. check_include_file( "net/if.h" HAVE_NET_IF_H )
  150. if( NOT HAVE_NET_IF_H )
  151. find_path( NET_IF_PATH "net/if.h" )
  152. if( NET_IF_PATH )
  153. set( HAVE_NET_IF_H "1" )
  154. endif( )
  155. endif( )
  156. check_include_file( "paths.h" HAVE_PATHS_H )
  157. check_include_file( "pty.h" HAVE_PTY_H )
  158. check_include_file( "stdint.h" HAVE_STDINT_H )
  159. check_include_file( "stdio.h" HAVE_STDIO_H )
  160. check_include_file( "stdlib.h" HAVE_STDLIB_H )
  161. check_include_file( "strings.h" HAVE_STRINGS_H )
  162. check_include_file( "string.h" HAVE_STRING_H )
  163. check_include_file( "sysent.h" HAVE_SYSENT_H )
  164. check_include_file( "sys/acl.h" HAVE_SYS_ACL_H )
  165. check_include_file( "sys/bitypes.h" HAVE_SYS_BITYPES_H )
  166. check_include_file( "sys/dir.h" HAVE_SYS_DIR_H )
  167. check_include_file( "sys/filio.h" HAVE_SYS_FILIO_H )
  168. check_include_file( "sys/mman.h" HAVE_SYS_MMAN_H )
  169. check_include_file( "sys/mntent.h" HAVE_SYS_MNTENT_H )
  170. check_include_file( "sys/mnttab.h" HAVE_SYS_MNTTAB_H )
  171. check_include_file( "sys/mount.h" HAVE_SYS_MOUNT_H )
  172. if( NOT HAVE_SYS_MOUNT_H )
  173. find_path( SYS_MOUNT_PATH "sys/mount.h" )
  174. if( SYS_MOUNT_PATH )
  175. set( HAVE_SYS_MOUNT_H "1" )
  176. endif( )
  177. endif( )
  178. check_include_file( "sys/ndir.h" HAVE_SYS_NDIR_H )
  179. check_include_file( "sys/param.h" HAVE_SYS_PARAM_H )
  180. check_include_file( "sys/prctl.h" HAVE_SYS_PRCTL_H )
  181. check_include_file( "sys/select.h" HAVE_SYS_SELECT_H )
  182. check_include_file( "sys/soundcard.h" HAVE_SYS_SOUNDCARD_H )
  183. check_include_file( "sys/stat.h" HAVE_SYS_STAT_H )
  184. check_include_file( "sys/stropts.h" HAVE_SYS_STROPTS_H )
  185. check_include_file( "sys/types.h" HAVE_SYS_TYPES_H )
  186. check_include_file( "sys/ucred.h" HAVE_SYS_UCRED_H )
  187. if( NOT HAVE_SYS_UCRED_H )
  188. find_path( SYS_UCRED_PATH "sys/ucred.h" )
  189. if( SYS_UCRED_PATH )
  190. set( HAVE_SYS_UCRED_H "1" )
  191. endif( )
  192. endif( )
  193. check_include_file( "sys/xattr.h" HAVE_SYS_XATTR_H )
  194. check_include_file( "termios.h" HAVE_TERMIOS_H )
  195. check_include_file( "termio.h" HAVE_TERMIO_H )
  196. check_include_file( "unistd.h" HAVE_UNISTD_H )
  197. check_include_file( "util.h" HAVE_UTIL_H )
  198. check_include_file( "values.h" HAVE_VALUES_H )
  199. # FIXME I'm not sure if test TIME_WITH_SYS_TIME are correct
  200. check_include_file( "sys/time.h" HAVE_SYS_TIME_H )
  201. check_include_file( "time.h" HAVE_TIME_H )
  202. if( HAVE_SYS_TIME_H AND HAVE_TIME_H )
  203. set( TIME_WITH_SYS_TIME 1 )
  204. endif( HAVE_SYS_TIME_H AND HAVE_TIME_H )
  205. if( HAVE_SYS_ACL_H )
  206. check_include_file( "acl/libacl.h" HAVE_ACL_LIBACL_H )
  207. if( HAVE_ACL_LIBACL_H )
  208. check_library_exists( acl acl_init "" HAVE_ACL_INIT )
  209. if( HAVE_ACL_INIT AND HAVE_SYS_XATTR_H )
  210. set( USE_POSIX_ACL 1 )
  211. set( HAVE_NON_POSIX_ACL_EXTENSIONS 1 )
  212. set( ACL_LIBRARIES acl attr )
  213. endif( HAVE_ACL_INIT AND HAVE_SYS_XATTR_H )
  214. else( HAVE_ACL_LIBACL_H )
  215. check_library_exists( c acl_init "" HAVE_ACL_INIT )
  216. if( HAVE_ACL_INIT )
  217. set( USE_POSIX_ACL 1 )
  218. set( ACL_LIBRARIES c )
  219. endif( HAVE_ACL_INIT )
  220. endif( HAVE_ACL_LIBACL_H )
  221. endif( HAVE_SYS_ACL_H )
  222. check_include_file( "valgrind/memcheck.h" HAVE_VALGRIND_MEMCHECK_H )
  223. check_include_file( "values.h" HAVE_VALUES_H )
  224. check_include_file( "X11/extensions/shape.h" HAVE_X11_EXTENSIONS_SHAPE_H )
  225. check_include_file( "/usr/src/sys/gnu/i386/isa/sound/awe_voice.h" HAVE__USR_SRC_SYS_GNU_I386_ISA_SOUND_AWE_VOICE_H )
  226. check_include_file( "/usr/src/sys/i386/isa/sound/awe_voice.h" HAVE__USR_SRC_SYS_I386_ISA_SOUND_AWE_VOICE_H )
  227. check_function_exists( random HAVE_RANDOM )
  228. check_symbol_exists( random "stdlib.h" HAVE_RANDOM_PROTO )
  229. check_function_exists( srandom HAVE_SRANDOM )
  230. check_symbol_exists( srandom "stdlib.h" HAVE_SRANDOM_PROTO )
  231. check_function_exists( seteuid HAVE_SETEUID )
  232. check_function_exists( setegid HAVE_SETEGID )
  233. check_function_exists( gethostname HAVE_GETHOSTNAME )
  234. check_symbol_exists( gethostname "unistd.h" HAVE_GETHOSTNAME_PROTO )
  235. check_function_exists( vsnprintf HAVE_VSNPRINTF )
  236. check_function_exists( snprintf HAVE_SNPRINTF )
  237. check_function_exists( setenv HAVE_SETENV )
  238. check_symbol_exists( setenv "stdlib.h" HAVE_SETENV_PROTO )
  239. check_function_exists( unsetenv HAVE_UNSETENV )
  240. check_symbol_exists( unsetenv "stdlib.h" HAVE_UNSETENV_PROTO )
  241. check_function_exists( mkdtemp HAVE_MKDTEMP )
  242. check_symbol_exists( mkdtemp "stdlib.h" HAVE_MKDTEMP_PROTO )
  243. check_function_exists( mkstemp HAVE_MKSTEMP )
  244. check_symbol_exists( mkstemp "stdlib.h" HAVE_MKSTEMP_PROTO )
  245. check_function_exists( mkstemps HAVE_MKSTEMPS )
  246. check_symbol_exists( mkstemps "stdlib.h" HAVE_MKSTEMPS_PROTO )
  247. check_function_exists( initgroups HAVE_INITGROUPS )
  248. check_symbol_exists( initgroups "grp.h;unistd.h" HAVE_INITGROUPS_PROTO )
  249. check_function_exists( strlcat HAVE_STRLCAT )
  250. check_symbol_exists( strlcat "string.h" HAVE_STRLCAT_PROTO )
  251. check_function_exists( strlcpy HAVE_STRLCPY )
  252. check_symbol_exists( strlcpy "string.h" HAVE_STRLCPY_PROTO )
  253. check_symbol_exists( S_ISSOCK "sys/stat.h" HAVE_S_ISSOCK )
  254. check_symbol_exists( gethostbyname2 "netdb.h" HAVE_GETHOSTBYNAME2 )
  255. check_symbol_exists( gethostbyname2_r "netdb.h" HAVE_GETHOSTBYNAME2_R )
  256. check_symbol_exists( gethostbyname_r "netdb.h" HAVE_GETHOSTBYNAME_R )
  257. check_symbol_exists( gai_strerror "sys/types.h;sys/socket.h;netdb.h" HAVE_GAI_STRERROR )
  258. check_symbol_exists( getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO )
  259. check_symbol_exists( backtrace "execinfo.h" HAVE_BACKTRACE )
  260. check_cxx_source_compiles( "#include <cxxabi.h>
  261. int main() { abi::__cxa_demangle(0, 0, 0, 0); return 0; }"
  262. HAVE_ABI_CXA_DEMANGLE )
  263. # Some declarations are needed by demangle.h (libiberty.h) and/or bfd.h but we
  264. # will check them uncondionally
  265. # See WITH_LIBBFD also see binutils bugs 14243 and 14072
  266. # NOTE: those headers use HAVE_DECL_* names but we would follow our macro
  267. # naming style
  268. check_symbol_exists( basename "libgen.h" HAVE_BASENAME_PROTO )
  269. check_symbol_exists( ffs "string.h" HAVE_FFS_PROTO )
  270. check_symbol_exists( asprintf "stdio.h" HAVE_ASPRINTF_PROTO )
  271. check_symbol_exists( vasprintf "stdio.h" HAVE_VASPRINTF_PROTO )
  272. check_symbol_exists( snprintf "stdio.h" HAVE_SNPRINTF_PROTO )
  273. check_symbol_exists( vsnprintf "stdarg.h" HAVE_VSNPRINTF_PROTO )
  274. check_symbol_exists( strvercmp "string.h" HAVE_STRVERCMP_PROTO )
  275. check_function_exists( usleep HAVE_USLEEP )
  276. check_symbol_exists( usleep "unistd.h" HAVE_USLEEP_PROTO )
  277. if (HAVE_ALLOCA_H )
  278. check_symbol_exists( alloca "alloca.h" HAVE_ALLOCA )
  279. else (HAVE_ALLOCA_H )
  280. check_symbol_exists( alloca "stdlib.h" HAVE_ALLOCA )
  281. endif (HAVE_ALLOCA_H )
  282. if( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
  283. set( HAVE_ALLOCA 1 )
  284. endif( )
  285. check_function_exists( getmntinfo HAVE_GETMNTINFO )
  286. check_function_exists( getnameinfo HAVE_GETNAMEINFO )
  287. check_function_exists( getpagesize HAVE_GETPAGESIZE )
  288. check_function_exists( getpeereid HAVE_GETPEEREID )
  289. check_function_exists( getpeername HAVE_GETPEERNAME )
  290. check_function_exists( getprotobyname_r HAVE_GETPROTOBYNAME_R )
  291. check_function_exists( getpt HAVE_GETPT )
  292. check_function_exists( getservbyname_r HAVE_GETSERVBYNAME_R )
  293. check_function_exists( getservbyport_r HAVE_GETSERVBYPORT_R )
  294. check_function_exists( getsockname HAVE_GETSOCKNAME )
  295. check_function_exists( getsockopt HAVE_GETSOCKOPT )
  296. check_function_exists( gettimeofday HAVE_GETTIMEOFDAY )
  297. check_function_exists( grantpt HAVE_GRANTPT )
  298. check_function_exists( if_nametoindex HAVE_IF_NAMETOINDEX )
  299. check_function_exists( index HAVE_INDEX)
  300. check_function_exists( inet_ntop HAVE_INET_NTOP )
  301. check_function_exists( inet_pton HAVE_INET_PTON )
  302. check_function_exists( setfsent HAVE_SETFSENT )
  303. check_function_exists( setgroups HAVE_SETGROUPS )
  304. check_function_exists( setlocale HAVE_SETLOCALE )
  305. check_function_exists( setmntent HAVE_SETMNTENT )
  306. check_function_exists( setpriority HAVE_SETPRIORITY )
  307. check_function_exists( isnan HAVE_FUNC_ISNAN )
  308. check_function_exists( _finite HAVE_FUNC__FINITE )
  309. check_function_exists( finite HAVE_FUNC_FINITE )
  310. check_function_exists( isinf HAVE_FUNC_ISINF )
  311. check_function_exists( freeaddrinfo HAVE_FREEADDRINFO )
  312. check_function_exists( strtoll HAVE_STRTOLL )
  313. check_function_exists( socket HAVE_SOCKET )
  314. check_function_exists( strfmon HAVE_STRFMON )
  315. check_function_exists( stpcpy HAVE_STPCPY )
  316. check_function_exists( readdir_r HAVE_READDIR_R )
  317. check_function_exists( tcgetattr HAVE_TCGETATTR )
  318. check_function_exists( tcsetattr HAVE_TCSETATTR )
  319. check_function_exists( strcasecmp HAVE_STRCASECMP )
  320. check_function_exists( strchr HAVE_STRCHR )
  321. check_function_exists( strcmp HAVE_STRCMP )
  322. check_function_exists( strrchr HAVE_STRRCHR )
  323. check_function_exists( ptsname HAVE_PTSNAME )
  324. check_function_exists( unlockpt HAVE_UNLOCKPT )
  325. check_function_exists( _getpty HAVE__GETPTY )
  326. check_function_exists( __argz_count HAVE___ARGZ_COUNT )
  327. check_function_exists( __argz_next HAVE___ARGZ_NEXT )
  328. check_function_exists( __argz_stringify HAVE___ARGZ_STRINGIFY )
  329. check_function_exists( sendfile HAVE_SENDFILE )
  330. check_function_exists( rindex HAVE_RINDEX )
  331. check_function_exists( putenv HAVE_PUTENV )
  332. check_function_exists( poll HAVE_POLL )
  333. check_function_exists( memcpy HAVE_MEMCPY )
  334. check_function_exists( madvise HAVE_MADVISE )
  335. check_function_exists( getgroups HAVE_GETGROUPS )
  336. check_function_exists( getcwd HAVE_GETCWD )
  337. check_function_exists( dlerror HAVE_DLERROR )
  338. if( NOT HAVE_DLERROR )
  339. check_library_exists( dl dlerror "" HAVE_DLERROR_LIB )
  340. if( HAVE_DLERROR_LIB )
  341. set( HAVE_DLERROR 1 )
  342. set( DLERROR_LIBRARIES dl )
  343. endif( HAVE_DLERROR_LIB )
  344. endif( NOT HAVE_DLERROR )
  345. check_function_exists( crypt HAVE_CRYPT )
  346. if( NOT HAVE_CRYPT )
  347. check_library_exists( crypt crypt "" HAVE_CRYPT_LIB )
  348. if( HAVE_CRYPT_LIB )
  349. set( HAVE_CRYPT 1 )
  350. set( CRYPT_LIBRARIES crypt )
  351. endif( HAVE_CRYPT_LIB )
  352. endif( NOT HAVE_CRYPT )
  353. if( NOT HAVE_CRYPT )
  354. check_library_exists( c crypt "" HAVE_CRYPT_LIBC )
  355. if( HAVE_CRYPT_LIBC )
  356. set( HAVE_CRYPT 1 )
  357. set( CRYPT_LIBRARIES c )
  358. endif( HAVE_CRYPT_LIBC )
  359. endif( NOT HAVE_CRYPT )
  360. check_function_exists( bcopy HAVE_BCOPY )
  361. check_function_exists( mmap HAVE_MMAP )
  362. check_function_exists( munmap HAVE_MUNMAP )
  363. check_type_size( "char*" SIZEOF_CHAR_P )
  364. check_type_size( "int" SIZEOF_INT )
  365. check_type_size( "long" SIZEOF_LONG )
  366. check_type_size( "short" SIZEOF_SHORT )
  367. check_type_size( "size_t" SIZEOF_SIZE_T )
  368. check_type_size( "unsigned long" SIZEOF_UNSIGNED_LONG )
  369. set( CMAKE_EXTRA_INCLUDE_FILES "netdb.h" )
  370. check_type_size( "struct addrinfo" STRUCT_ADDRINFO )
  371. set( CMAKE_EXTRA_INCLUDE_FILES "netinet/in.h" )
  372. check_type_size( "struct sockaddr_in6" HAVE_STRUCT_SOCKADDR_IN6 )
  373. unset( CMAKE_EXTRA_INCLUDE_FILES )
  374. check_c_source_compiles("
  375. #include <features.h>
  376. #ifndef __GNU_LIBRARY__
  377. #error
  378. #endif
  379. int main(int argc, char *argv[]) { return 0; } "
  380. _GNU_SOURCE )
  381. check_c_source_compiles("
  382. #include <unistd.h>
  383. int main(int argc, char *argv[]) { revoke(\"/dev/tty\"); return 0; } "
  384. HAVE_REVOKE )
  385. check_c_source_runs("
  386. #include <sys/types.h>
  387. #include <sys/socket.h>
  388. #include <netdb.h>
  389. #include <string.h>
  390. int main()
  391. {
  392. struct addrinfo hint, *res;
  393. int err;
  394. memset(&hint, 0, sizeof(hint));
  395. hint.ai_family = AF_INET;
  396. hint.ai_protocol = 0;
  397. hint.ai_socktype = SOCK_STREAM;
  398. hint.ai_flags = AI_PASSIVE;
  399. err = getaddrinfo(0, \"18300\", &hint, &res); /* kxmlrpc tries this */
  400. if (err != 0 || res == 0 || res->ai_family != AF_INET)
  401. return 1;
  402. return 0;
  403. }"
  404. HAVE_GOOD_GETADDRINFO
  405. )
  406. if( NOT HAVE_GOOD_GETADDRINFO )
  407. set( HAVE_BROKEN_GETADDRINFO 1 )
  408. endif( NOT HAVE_GOOD_GETADDRINFO )
  409. # save CMAKE_REQUIRED_LIBRARIES
  410. set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
  411. set( CMAKE_REQUIRED_LIBRARIES resolv )
  412. check_c_source_compiles("
  413. #include <sys/types.h>
  414. #include <netinet/in.h>
  415. #include <arpa/nameser.h>
  416. #include <resolv.h>
  417. int main(int argc, char *argv[]) { res_init(); return 0; } "
  418. HAVE_RES_INIT )
  419. if( HAVE_RES_INIT )
  420. set( RESOLV_LIBRARIES resolv )
  421. endif( HAVE_RES_INIT)
  422. set( CMAKE_REQUIRED_LIBRARIES util )
  423. if( HAVE_PTY_H )
  424. set( USE_OPENPTY_H pty.h )
  425. elseif( HAVE_UTIL_H )
  426. set( USE_OPENPTY_H util.h )
  427. elseif( HAVE_LIBUTIL_H )
  428. set( USE_OPENPTY_H libutil.h )
  429. endif( )
  430. if( USE_OPENPTY_H )
  431. check_c_source_runs("
  432. #include <${USE_OPENPTY_H}>
  433. int main(int argc, char* argv[]) {
  434. int master_fd, slave_fd;
  435. int result;
  436. result = openpty(&master_fd, &slave_fd, 0, 0, 0);
  437. return 0;
  438. }"
  439. HAVE_OPENPTY
  440. )
  441. endif( )
  442. if( HAVE_OPENPTY )
  443. set( LIB_UTIL util )
  444. endif( )
  445. # restore CMAKE_REQUIRED_LIBRARIES
  446. set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
  447. unset( bak_CMAKE_REQUIRED_LIBRARIES )
  448. #### set tdesu backend ##########################
  449. if( WITH_SUDO_TDESU_BACKEND )
  450. set( DEFAULT_SUPER_USER_COMMAND sudo CACHE INTERNAL "" FORCE )
  451. else()
  452. set( DEFAULT_SUPER_USER_COMMAND su CACHE INTERNAL "" FORCE )
  453. endif()
  454. find_file( TDESU_BACKEND ${DEFAULT_SUPER_USER_COMMAND} PATHS ENV PATH )
  455. if( TDESU_BACKEND-NOTFOUND )
  456. tde_message_fatal( "${DEFAULT_SUPER_USER_COMMAND} was chosen as tdesu backend, but was not found in path." )
  457. endif( TDESU_BACKEND-NOTFOUND )
  458. #### set some constants #########################
  459. if( NOT "${TDEDIR}" )
  460. if( DEFINED ENV{TDEDIR} )
  461. set( TDEDIR "$ENV{TDEDIR}" )
  462. else( )
  463. set( TDEDIR "${CMAKE_INSTALL_PREFIX}" )
  464. endif( )
  465. endif( )
  466. set( KDE_COMPILER_VERSION "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" )
  467. set( KDE_COMPILING_OS "${CMAKE_SYSTEM_NAME}" )
  468. set( LTDL_OBJDIR \".\" )
  469. set( KDELIBSUFF "${LIB_SUFFIX}" )
  470. set( kde_socklen_t socklen_t )
  471. if( WITH_TDEHWLIB )
  472. set( __TDE_HAVE_TDEHWLIB 1 )
  473. endif( WITH_TDEHWLIB )
  474. ##### check for libdl ###########################
  475. set( DL_LIBRARIES dl )
  476. check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )
  477. if( NOT HAVE_LIBDL )
  478. unset( DL_LIBRARIES )
  479. check_function_exists( dlopen HAVE_DLOPEN )
  480. if( HAVE_DLOPEN )
  481. set( HAVE_LIBDL 1 )
  482. endif( HAVE_DLOPEN )
  483. endif( NOT HAVE_LIBDL )
  484. ##### check for magic ###########################
  485. set( MAGIC_LIBRARIES magic )
  486. check_library_exists( ${MAGIC_LIBRARIES} magic_load "" HAVE_LIBMAGIC )
  487. if( HAVE_LIBMAGIC )
  488. check_library_exists( ${MAGIC_LIBRARIES} magic_getpath "" HAVE_LIBMAGIC_GETPATH )
  489. if( NOT HAVE_LIBMAGIC_GETPATH )
  490. execute_process(
  491. COMMAND file --version
  492. OUTPUT_VARIABLE LIBMAGIC_VERSION
  493. ERROR_VARIABLE LIBMAGIC_VERSION
  494. )
  495. string(REGEX REPLACE ".*magic file from ([^ \n]*).*" "\\1" LIBMAGIC_PATH ${LIBMAGIC_VERSION} )
  496. message( STATUS "libmagick default path ${LIBMAGIC_PATH}" )
  497. endif( NOT HAVE_LIBMAGIC_GETPATH )
  498. else( HAVE_LIBMAGIC )
  499. tde_message_fatal( "libmagic is required, but not found on your system" )
  500. endif( HAVE_LIBMAGIC )
  501. ##### check for utempter ########################
  502. if( WITH_UTEMPTER )
  503. check_include_file( utempter.h HAVE_UTEMPTER_H )
  504. check_library_exists( utempter addToUtmp "" HAVE_ADDTOUTEMP )
  505. if( NOT DEFINED UTEMPTER_HELPER )
  506. message( STATUS "Looking for utempter helper" )
  507. find_program( UTEMPTER_HELPER utempter
  508. PATHS
  509. /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/utempter
  510. /usr/lib${LIB_SUFFIX}/utempter
  511. /usr/libexec/utempter
  512. /usr/libexec
  513. /usr/sbin
  514. /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}/utempter
  515. /usr/local/lib${LIB_SUFFIX}/utempter
  516. /usr/local/libexec/utempter
  517. /usr/local/libexec
  518. /usr/local/sbin
  519. )
  520. if( UTEMPTER_HELPER )
  521. message( STATUS "Looking for utempter helper - found" )
  522. else( )
  523. message( STATUS "Looking for utempter helper - not found" )
  524. endif( )
  525. endif( )
  526. if( HAVE_UTEMPTER_H AND HAVE_ADDTOUTEMP AND UTEMPTER_HELPER )
  527. set( HAVE_UTEMPTER 1 )
  528. set( UTEMPTER_LIBRARY utempter )
  529. else( )
  530. message(FATAL_ERROR "\nutempter are requested, but not found on your system" )
  531. endif( )
  532. endif( )
  533. ##### check for zlib ############################
  534. find_package( ZLIB )
  535. if( NOT ZLIB_FOUND )
  536. message(FATAL_ERROR "\nzlib are required, but not found on your system" )
  537. endif( NOT ZLIB_FOUND )
  538. set( HAVE_LIBZ 1 )
  539. #### check for bzip2 ############################
  540. find_package( BZip2 )
  541. if( NOT BZIP2_FOUND )
  542. # FIXME I'm not sure if bzip2 are required; maybe is OPTIONal?
  543. message(FATAL_ERROR "\nbzip2 are required, but not found on your system" )
  544. endif( NOT BZIP2_FOUND )
  545. set( HAVE_BZIP2_SUPPORT 1 )
  546. if( BZIP2_NEED_PREFIX )
  547. set( NEED_BZ2_PREFIX 1 )
  548. endif( BZIP2_NEED_PREFIX )
  549. ##### check for lzma/xz #########################
  550. if( WITH_LZMA )
  551. pkg_search_module( LZMA liblzma )
  552. if( NOT LZMA_FOUND )
  553. find_path( LZMA_INCLUDE_DIR lzma.h )
  554. find_library( LZMA_LIBRARY lzma )
  555. if( LZMA_LIBRARY AND LZMA_INCLUDE_DIR )
  556. message( STATUS "Found LZMA: ${LZMA_LIBRARY}" )
  557. set( LZMA_FOUND 1 )
  558. set( LZMA_INCLUDE_DIRS ${LZMA_INCLUDE_DIR} )
  559. set( LZMA_LIBRARIES lzma )
  560. endif( LZMA_LIBRARY AND LZMA_INCLUDE_DIR )
  561. endif( NOT LZMA_FOUND )
  562. check_library_exists( lzma lzma_code "" LZMA_CODE_FOUND )
  563. if( NOT LZMA_FOUND OR NOT LZMA_CODE_FOUND )
  564. tde_message_fatal( "LZMA is requested, but not found on your system" )
  565. endif( NOT LZMA_FOUND OR NOT LZMA_CODE_FOUND )
  566. set( HAVE_XZ_SUPPORT 1 )
  567. endif( WITH_LZMA )
  568. ##### check for pcsc ############################
  569. if( WITH_PCSC )
  570. find_path( PCSCLITE_INCLUDE_DIR pcsclite.h
  571. HINTS /usr/include/PCSC )
  572. find_library( PCSCLITE_LIBRARY NAMES pcsclite libpcsclite PCSC )
  573. if( PCSCLITE_LIBRARY AND PCSCLITE_INCLUDE_DIR )
  574. message( STATUS "Found PCSCLITE: ${PCSCLITE_LIBRARY}" )
  575. set( PCSCLITE_FOUND 1 )
  576. set( PCSCLITE_INCLUDE_DIRS ${PCSCLITE_INCLUDE_DIR} )
  577. set( PCSCLITE_LIBRARIES ${PCSCLITE_LIBRARY} )
  578. endif( PCSCLITE_LIBRARY AND PCSCLITE_INCLUDE_DIR )
  579. if( NOT PCSCLITE_FOUND )
  580. tde_message_fatal( "PCSCLITE is requested, but not found on your system" )
  581. endif( NOT PCSCLITE_FOUND )
  582. set( HAVE_PCSC_SUPPORT 1 )
  583. endif( WITH_PCSC )
  584. ##### check for pkcs ############################
  585. if( WITH_PKCS )
  586. pkg_search_module( LIBPKCS11-HELPER libpkcs11-helper-1 )
  587. if( NOT LIBPKCS11-HELPER_FOUND )
  588. message(FATAL_ERROR "\nPKCS support was requested, but libpkcs11-helper-1 was not found on your system" )
  589. endif( NOT LIBPKCS11-HELPER_FOUND )
  590. find_library( OPENSC_PKCS11_PROVIDER_LIBRARY NAMES opensc-pkcs11.so )
  591. if( OPENSC_PKCS11_PROVIDER_LIBRARY )
  592. set( OPENSC_PKCS11_PROVIDER_FOUND 1 )
  593. message( STATUS "Found OpenSC PKCS11 provider: ${OPENSC_PKCS11_PROVIDER_LIBRARY}" )
  594. endif( OPENSC_PKCS11_PROVIDER_LIBRARY )
  595. if( NOT OPENSC_PKCS11_PROVIDER_FOUND )
  596. tde_message_fatal( "PKCS is requested, but no OpenSC PKCS11 provider was found on your system" )
  597. endif( NOT OPENSC_PKCS11_PROVIDER_FOUND )
  598. pkg_search_module( SSL openssl )
  599. if( NOT SSL_FOUND OR SSL_VERSION VERSION_LESS "1.1" )
  600. set( HAVE_PKCS 1 )
  601. else( )
  602. set( WITH_PKCS OFF CACHE INTERNAL "PKCS support is not ready for OpenSSL >= 1.1" FORCE )
  603. message( WARNING "\nPKCS support is not ready for OpenSSL >= 1.1" )
  604. endif( )
  605. endif( )
  606. ##### check for pkcs ############################
  607. if( WITH_CRYPTSETUP )
  608. pkg_search_module( LIBCRYPTSETUP libcryptsetup )
  609. if( NOT LIBCRYPTSETUP_FOUND )
  610. find_library( LIBCRYPTSETUP_LIBRARY cryptsetup )
  611. if( NOT LIBCRYPTSETUP_LIBRARY )
  612. message(FATAL_ERROR "\ncryptsetup support was requested, but libcryptsetup was not found on your system" )
  613. endif ( NOT LIBCRYPTSETUP_LIBRARY )
  614. set( LIBCRYPTSETUP_LIBRARIES ${LIBCRYPTSETUP_LIBRARY} )
  615. endif( NOT LIBCRYPTSETUP_FOUND )
  616. set( HAVE_CRYPTSETUP 1 )
  617. if ( HAVE_CRYPTSETUP )
  618. # save CMAKE_REQUIRED_LIBRARIES
  619. set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
  620. set( CMAKE_REQUIRED_LIBRARIES ${LIBCRYPTSETUP_LIBRARIES} )
  621. check_c_source_compiles("
  622. #include <stddef.h>
  623. #include <libcryptsetup.h>
  624. int main(int argc, char *argv[]) { crypt_keyslot_info status = CRYPT_SLOT_INVALID; return 0; } "
  625. HAVE_NEW_CRYPTSETUP )
  626. check_c_source_compiles("
  627. #include <stddef.h>
  628. #include <libcryptsetup.h>
  629. int main(int argc, char *argv[]) { crypt_get_type(NULL); return 0; } "
  630. HAVE_CRYPTSETUP_GET_TYPE )
  631. # restore CMAKE_REQUIRED_LIBRARIES
  632. set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
  633. unset( bak_CMAKE_REQUIRED_LIBRARIES )
  634. endif( )
  635. if ( NOT HAVE_NEW_CRYPTSETUP )
  636. set( CRYPTSETUP_OLD_API 1 )
  637. endif( )
  638. endif( )
  639. ##### check for jpeg ############################
  640. find_package( JPEG )
  641. if( NOT JPEG_FOUND )
  642. # FIXME I think jpeg support must be required
  643. message(FATAL_ERROR "\njpeg are required, but not found on your system" )
  644. endif( NOT JPEG_FOUND )
  645. set( HAVE_LIBJPEG 1 )
  646. ##### check for png #############################
  647. find_package( PNG )
  648. if( NOT PNG_FOUND )
  649. # FIXME I think png support must be required
  650. message(FATAL_ERROR "\npng are required, but not found on your system" )
  651. endif( NOT PNG_FOUND )
  652. set( HAVE_LIBPNG 1 )
  653. ##### check for tiff ############################
  654. if( WITH_TIFF )
  655. find_package( TIFF )
  656. if( NOT TIFF_FOUND )
  657. message(FATAL_ERROR "\ntiff are requested, but not found on your system" )
  658. endif( NOT TIFF_FOUND )
  659. set( HAVE_LIBTIFF 1)
  660. endif( WITH_TIFF )
  661. ##### check for jasper ##########################
  662. if( WITH_JASPER )
  663. find_package( Jasper )
  664. if( NOT JASPER_FOUND )
  665. message(FATAL_ERROR "\njasper are requested, but not found on your system" )
  666. endif( NOT JASPER_FOUND )
  667. set( HAVE_JASPER 1 )
  668. endif( WITH_JASPER )
  669. ##### check for openexr #########################
  670. if( WITH_OPENEXR )
  671. pkg_search_module( OPENEXR OpenEXR )
  672. if( NOT OPENEXR_FOUND )
  673. message(FATAL_ERROR "\nopenexr are requested, but not found on your system" )
  674. endif( NOT OPENEXR_FOUND )
  675. set( HAVE_EXR 1 )
  676. endif( WITH_OPENEXR )
  677. ##### check for freetype2 #######################
  678. pkg_search_module( FREETYPE freetype2 )
  679. if( NOT FREETYPE_FOUND )
  680. message(FATAL_ERROR "\nfreetype2 are required, but not found on your system" )
  681. endif( NOT FREETYPE_FOUND )
  682. set( TDEINIT_USE_FONTCONFIG 1 )
  683. ##### check for fontconfig ######################
  684. pkg_search_module( FONTCONFIG fontconfig )
  685. if( NOT FONTCONFIG_FOUND )
  686. message(FATAL_ERROR "\nfontconfig are required, but not found on your system" )
  687. endif( NOT FONTCONFIG_FOUND )
  688. ##### check for Xrandr ##########################
  689. if( WITH_XRANDR )
  690. pkg_search_module( XRANDR xrandr>=1.2 )
  691. if( XRANDR_FOUND )
  692. set( XRANDR_SUPPORT 1 )
  693. else( XRANDR_FOUND )
  694. tde_message_fatal( "xrandr support was required, but not found on your system" )
  695. endif( XRANDR_FOUND )
  696. endif( WITH_XRANDR )
  697. ##### check for xrender #########################
  698. pkg_search_module( XRENDER xrender )
  699. if( XRENDER_FOUND )
  700. set( HAVE_XRENDER 1 )
  701. list( APPEND TDECORE_LIBRARY_DIRS ${XRENDER_LIBRARY_DIRS} )
  702. else( XRENDER_FOUND)
  703. message(FATAL_ERROR "\nxrender support is required, but not found on your system" )
  704. endif( XRENDER_FOUND )
  705. ##### check for xcomposite #########################
  706. if( WITH_XCOMPOSITE )
  707. pkg_search_module( XCOMPOSITE xcomposite )
  708. if( XCOMPOSITE_FOUND )
  709. set( HAVE_XCOMPOSITE 1 )
  710. else( WITH_XCOMPOSITE )
  711. tde_message_fatal( "xcomposite support was requested, but xcomposite was not found on your system" )
  712. endif( XCOMPOSITE_FOUND )
  713. endif( WITH_XCOMPOSITE )
  714. ##### check for mit-shm extension ##################
  715. if( WITH_MITSHM )
  716. tde_save_and_set( CMAKE_REQUIRED_FLAGS "-include X11/Xlib.h" )
  717. check_include_file( "X11/extensions/XShm.h" HAVE_MITSHM )
  718. tde_restore( CMAKE_REQUIRED_FLAGS )
  719. if( NOT HAVE_MITSHM )
  720. tde_message_fatal( "XShm extension is required, but was not found on your system" )
  721. endif( NOT HAVE_MITSHM )
  722. endif( WITH_MITSHM )
  723. ##### check for xext ###############################
  724. if( HAVE_XRENDER OR WITH_XCOMPOSITE OR WITH_XRANDR OR HAVE_X11_EXTENSIONS_SHAPE_H OR WITH_MITSHM )
  725. # xext (tdecore, tdeui, tderandr, tdestyles/keramik)
  726. pkg_search_module( XEXT xext )
  727. if( NOT XEXT_FOUND )
  728. tde_message_fatal( "xext is required, but was not found on your system" )
  729. endif( )
  730. endif( HAVE_XRENDER OR WITH_XCOMPOSITE OR WITH_XRANDR OR HAVE_X11_EXTENSIONS_SHAPE_H OR WITH_MITSHM )
  731. ##### check for libxml-2.0 ######################
  732. pkg_search_module( LIBXML2 libxml-2.0 )
  733. if( NOT LIBXML2_FOUND )
  734. message(FATAL_ERROR "\nlibxml-2.0 are required, but not found on your system" )
  735. endif( NOT LIBXML2_FOUND )
  736. ##### check for libxslt ######################
  737. pkg_search_module( LIBXSLT libxslt )
  738. if( NOT LIBXSLT_FOUND )
  739. message(FATAL_ERROR "\nlibxslt are required, but not found on your system" )
  740. endif( NOT LIBXSLT_FOUND )
  741. ##### check for glib-2.0 & friends ##############
  742. pkg_search_module( GLIB2 glib-2.0 )
  743. if( NOT GLIB2_FOUND )
  744. tde_message_fatal( "glib-2.0 are required, but not found on your system" )
  745. endif( )
  746. pkg_search_module( GOBJECT2 gobject-2.0 )
  747. if( NOT GLIB2_FOUND )
  748. tde_message_fatal( "gobject-2.0 are required, but not found on your system" )
  749. endif( )
  750. ##### check for ALSA ############################
  751. # FIXME I propose to drop support for very old ALSA versions (i.e 0.5)
  752. if( WITH_ALSA )
  753. find_package( ALSA )
  754. if( NOT ALSA_FOUND )
  755. message(FATAL_ERROR "\nALSA support are requested, but not found on your system" )
  756. endif( NOT ALSA_FOUND )
  757. set( HAVE_LIBASOUND2 1 )
  758. # FIXME I'm not sure if order is correct
  759. check_include_file( "alsa/asoundlib.h" HAVE_ALSA_ASOUNDLIB_H )
  760. if( NOT HAVE_ALSA_ASOUNDLIB_H )
  761. check_include_file( "sys/asoundlib.h" HAVE_SYS_ASOUNDLIB_H )
  762. endif( NOT HAVE_ALSA_ASOUNDLIB_H )
  763. endif( WITH_ALSA )
  764. ##### check for aRts ############################
  765. if( WITH_ARTS )
  766. pkg_search_module( ARTS arts )
  767. if( ARTS_FOUND )
  768. set( ARTS_MCOPIDL_EXECUTABLE ${ARTS_PREFIX}/bin/mcopidl )
  769. else( ARTS_FOUND )
  770. message(FATAL_ERROR "\naRts are requested, but not found on your system" )
  771. endif( ARTS_FOUND )
  772. else( WITH_ARTS )
  773. set( WITHOUT_ARTS 1 )
  774. endif( WITH_ARTS )
  775. ##### check for Xft #############################
  776. string( REGEX REPLACE ".*;([^;]*qt-mt);.*" "\\1" TQT_MT ";${TQT_LIBRARIES};" )
  777. if( TQT_MT )
  778. pkg_search_module( TQT_MT ${TQT_MT} )
  779. tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "${TQT_MT_LIBRARIES}" )
  780. check_library_exists( tqt-mt XftInit "" TDEINIT_USE_XFT )
  781. tde_restore( CMAKE_REQUIRED_LIBRARIES )
  782. endif( TQT_MT )
  783. if( TDEINIT_USE_XFT )
  784. pkg_search_module( XFT xft )
  785. if( NOT XFT_FOUND )
  786. tde_message_fatal( "Xft is required, but not found on your system" )
  787. endif( NOT XFT_FOUND )
  788. endif( TDEINIT_USE_XFT )
  789. ##### check for libart ##########################
  790. if( WITH_LIBART )
  791. pkg_search_module( LIBART libart-2.0 )
  792. if( NOT LIBART_FOUND )
  793. message(FATAL_ERROR "\nlibart-2.0 support are requested, but not found on your system" )
  794. endif( NOT LIBART_FOUND )
  795. set( HAVE_LIBART 1 )
  796. list( APPEND TDECORE_LIBRARY_DIRS ${LIBART_LIBRARY_DIRS} )
  797. endif( WITH_LIBART )
  798. ##### check for libidn ##########################
  799. if( WITH_LIBIDN )
  800. pkg_search_module( LIBIDN libidn )
  801. if( NOT LIBIDN_FOUND )
  802. message(FATAL_ERROR "\nlibidn support are requested, but not found on your system" )
  803. endif( NOT LIBIDN_FOUND )
  804. set( HAVE_LIBIDN 1 )
  805. check_include_file( "idna.h" HAVE_IDNA_H )
  806. check_include_file( "punycode.h" HAVE_PUNYCODE_H )
  807. check_include_file( "stringprep.h" HAVE_STRINGPREP_H )
  808. list( APPEND TDECORE_LIBRARY_DIRS ${LIBIDN_LIBRARY_DIRS} )
  809. endif( WITH_LIBIDN )
  810. ##### check for libbfq ##########################
  811. if( WITH_LIBBFD )
  812. check_library_exists( bfd bfd_init "" HAVE_LIBBFD )
  813. if( NOT HAVE_LIBBFD )
  814. tde_message_fatal( "libbfd support is requested, but not found on your system" )
  815. endif( NOT HAVE_LIBBFD )
  816. set( LIBBFD_LIBRARIES bfd )
  817. check_include_file( "demangle.h" HAVE_DEMANGLE_H )
  818. endif( WITH_LIBBFD )
  819. ##### check for openssl #########################
  820. if( WITH_SSL )
  821. pkg_search_module( SSL openssl )
  822. if( NOT SSL_FOUND )
  823. check_include_file( openssl/ssl.h HAVE_OPENSSL_H )
  824. check_library_exists( ssl SSL_library_init "" HAVE_LIBSSL )
  825. check_library_exists( crypto EVP_EncryptInit_ex "" HAVE_LIBCRYPTO )
  826. if( HAVE_OPENSSL_H AND HAVE_LIBSSL AND HAVE_LIBCRYPTO )
  827. set( SSL_FOUND 1 CACHE INTERNAL "" FORCE )
  828. endif( HAVE_OPENSSL_H AND HAVE_LIBSSL AND HAVE_LIBCRYPTO )
  829. endif( NOT SSL_FOUND )
  830. if( NOT SSL_FOUND )
  831. tde_message_fatal( "SSL support is requested, but openssl not found on your system" )
  832. endif( NOT SSL_FOUND )
  833. set( KSSL_HAVE_SSL 1 )
  834. set( HAVE_SSL 1 )
  835. endif( WITH_SSL )
  836. ##### check for cups ############################
  837. # FIXME CUPS must be at least 1.1.9
  838. if( WITH_CUPS )
  839. find_package( Cups )
  840. if( NOT CUPS_FOUND )
  841. message(FATAL_ERROR "\nCUPS support are requested, but not found on your system" )
  842. endif( NOT CUPS_FOUND )
  843. set( HAVE_CUPS 1 )
  844. # FIXME if CUPS is at least 1.1.20, doesn't have password caching
  845. set( HAVE_CUPS_NO_PWD_CACHE 1 )
  846. # save CMAKE_REQUIRED_LIBRARIES
  847. set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
  848. set( CMAKE_REQUIRED_LIBRARIES ${CUPS_LIBRARIES} )
  849. check_c_source_compiles("
  850. #include <cups/cups.h>
  851. #include <cups/ipp.h>
  852. #include <cups/language.h>
  853. int main(int argc, char *argv[]) { ipp_attribute_t *attr = 0; ippGetName(attr); return 0; } "
  854. HAVE_CUPS_1_6 )
  855. # restore CMAKE_REQUIRED_LIBRARIES
  856. set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
  857. unset( bak_CMAKE_REQUIRED_LIBRARIES )
  858. endif( WITH_CUPS )
  859. ##### check for LUA #############################
  860. if( WITH_LUA )
  861. message(FATAL_ERROR "\nLUA support are not ready yet" )
  862. pkg_search_module( LUA lua )
  863. if( NOT LUA_FOUND )
  864. message(FATAL_ERROR "\nLUA support are requested, but not found on your system" )
  865. endif( NOT LUA_FOUND )
  866. set( HAVE_LUA 1 )
  867. endif( WITH_LUA )
  868. ##### check for avahi ###########################
  869. if( WITH_AVAHI )
  870. if( WITH_QT4 )
  871. endif( WITH_QT4 )
  872. if( WITH_QT3 )
  873. pkg_search_module( AVAHI avahi-tqt )
  874. if( NOT AVAHI_FOUND )
  875. message(FATAL_ERROR "\navahi support are requested, but not found on your system" )
  876. endif( NOT AVAHI_FOUND )
  877. set( AVAHI_API_0_6 1 )
  878. endif( WITH_QT3 )
  879. endif( )
  880. ##### check for libr ###########################
  881. # WARNING
  882. # before altering the LIBR_VERSION check,
  883. # please ensure that nothing changed in the
  884. # duplicated data definitions present in
  885. # tdeio/tdeio/tdefileitem.cpp
  886. if( WITH_ELFICON )
  887. pkg_search_module( LIBR libr )
  888. if( NOT LIBR_FOUND )
  889. message(FATAL_ERROR "\nelficon support was requested, but libr was not found on your system" )
  890. endif( NOT LIBR_FOUND )
  891. if( NOT "${LIBR_VERSION}" STREQUAL "0.6.0" )
  892. message(FATAL_ERROR "\nelficon support was requested, but the libr version on your system may not be compatible with TDE" )
  893. endif( NOT "${LIBR_VERSION}" STREQUAL "0.6.0" )
  894. set( HAVE_ELFICON 1 )
  895. endif( )
  896. ##### check for pcre ###########################
  897. if( WITH_PCRE )
  898. pkg_search_module( LIBPCRE libpcre )
  899. if( NOT LIBPCRE_FOUND )
  900. message(FATAL_ERROR "\npcre support are requested, but not found on your system" )
  901. endif( NOT LIBPCRE_FOUND )
  902. set( HAVE_PCREPOSIX 1 )
  903. endif( )
  904. ##### set DBUS file locations ##################
  905. if( NOT DEFINED DBUS_SYSTEM_CONF_DIRECTORY )
  906. set (DBUS_SYSTEM_CONF_DIRECTORY "/etc/dbus-1/system.d/" )
  907. message( STATUS "Using " ${DBUS_SYSTEM_CONF_DIRECTORY} " for DBUS configuration files" )
  908. endif( NOT DEFINED DBUS_SYSTEM_CONF_DIRECTORY )
  909. if( NOT DEFINED DBUS_SERVICE_DIRECTORY )
  910. set (DBUS_SERVICE_DIRECTORY "/usr/share/dbus-1/system-services/" )
  911. message( STATUS "Using " ${DBUS_SERVICE_DIRECTORY} " for DBUS service files" )
  912. endif( NOT DEFINED DBUS_SERVICE_DIRECTORY )
  913. ##### check for dbus-1 ###########################
  914. pkg_search_module( DBUS dbus-1 )
  915. if( NOT DBUS_FOUND )
  916. tde_message_fatal( "dbus-1 are required, but not found on your system" )
  917. endif( )
  918. ##### check for dbus-1-tqt ###########################
  919. pkg_search_module( DBUS_TQT dbus-1-tqt )
  920. if( DBUS_TQT_FOUND )
  921. find_program( DBUSXML2QT3_EXECUTABLE NAMES dbusxml2qt3 )
  922. else()
  923. tde_message_fatal( "dbus-1-tqt are required, but not found on your system" )
  924. endif( )
  925. list( APPEND TDECORE_LIBRARY_DIRS ${DBUS_TQT_LIBRARY_DIRS} )
  926. ##### Add '[KDE4]' to KDE4 menu items #########
  927. if( WITH_KDE4_MENU_SUFFIX )
  928. set( KDE4_MENU_SUFFIX 1 )
  929. endif ( WITH_KDE4_MENU_SUFFIX )
  930. ##### check for gcc visibility support #########
  931. # FIXME
  932. # This should check for [T]Qt3 visibility support
  933. if( WITH_GCC_VISIBILITY )
  934. if( NOT UNIX )
  935. message(FATAL_ERROR "\ngcc visibility support was requested, but your system is not *NIX" )
  936. endif( NOT UNIX )
  937. set( __KDE_HAVE_GCC_VISIBILITY 1 )
  938. set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
  939. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
  940. endif( )
  941. ##### check for inotify ###########################
  942. if( WITH_INOTIFY )
  943. check_include_file( "inotify.h" INOTIFY_FOUND )
  944. check_include_file( "sys/inotify.h" INOTIFY_SYS_FOUND )
  945. if( NOT INOTIFY_FOUND )
  946. if( NOT INOTIFY_SYS_FOUND )
  947. message(FATAL_ERROR "\ninotify support was requested, but inotify was not found on your system" )
  948. endif( NOT INOTIFY_SYS_FOUND )
  949. endif( NOT INOTIFY_FOUND )
  950. if( INOTIFY_FOUND )
  951. set( HAVE_INOTIFY 1 )
  952. endif( INOTIFY_FOUND )
  953. if( INOTIFY_SYS_FOUND )
  954. set( HAVE_INOTIFY 1 )
  955. set( HAVE_SYS_INOTIFY 1 )
  956. endif( INOTIFY_SYS_FOUND )
  957. endif( )
  958. ##### check for FAM/GAMIN ##########################
  959. if( WITH_GAMIN )
  960. check_include_file( "fam.h" HAVE_FAM_H )
  961. if( HAVE_FAM_H )
  962. pkg_search_module( GAMIN gamin )
  963. if( GAMIN_FOUND )
  964. set( HAVE_FAM 1 )
  965. list( APPEND TDECORE_LIBRARY_DIRS ${GAMIN_LIBRARY_DIRS} )
  966. else( GAMIN_FOUND )
  967. message(FATAL_ERROR "\nfam/gamin support was requested, but gamin was not found on your system" )
  968. endif( GAMIN_FOUND )
  969. else( HAVE_FAM_H )
  970. message(FATAL_ERROR "\nfam/gamin support was requested, but fam was not found on your system" )
  971. endif( HAVE_FAM_H )
  972. endif( WITH_GAMIN )
  973. ##### check for aspell ##########################
  974. # we need ASPELL_DATADIR too
  975. if( WITH_ASPELL )
  976. find_package( ASPELL )
  977. if( NOT ASPELL_FOUND )
  978. message(FATAL_ERROR "\nASPELL support are requested, but not found on your system" )
  979. endif( NOT ASPELL_FOUND )
  980. endif( WITH_ASPELL )
  981. ##### check for hspell ##########################
  982. if( WITH_HSPELL )
  983. find_package( HSPELL )
  984. if( NOT HSPELL_FOUND )
  985. message(FATAL_ERROR "\nHSPELL support are requested, but not found on your system" )
  986. endif( NOT HSPELL_FOUND )
  987. endif( WITH_HSPELL )
  988. ##### enable TDEIconLoader debugging ############
  989. if ( WITH_TDEICONLOADER_DEBUG )
  990. set ( TDEICONLOADER_DEBUG 1 )
  991. endif ( WITH_TDEICONLOADER_DEBUG )
  992. ##### write configure files #####################
  993. configure_file( config.h.cmake config.h )
  994. configure_file( dcop/dcop-path.h.cmake dcop/dcop-path.h )
  995. configure_file( tdecore/kdemacros.h.cmake tdecore/kdemacros.h )
  996. configure_file( kjs/global.h.in kjs/global.h )
  997. configure_file( tdeio/kssl/ksslconfig.h.cmake tdeio/kssl/ksslconfig.h )
  998. configure_file( kdoctools/checkXML.cmake kdoctools/checkXML )
  999. ##### tools #####################################
  1000. set( KDE3_DCOPIDL_EXECUTABLE ${CMAKE_BINARY_DIR}/dcop/dcopidl/dcopidl )
  1001. set( KDE3_DCOPIDL2CPP_EXECUTABLE ${CMAKE_BINARY_DIR}/dcop/dcopidl2cpp/dcopidl2cpp )
  1002. set( KDE3_MEINPROC_EXECUTABLE ${CMAKE_BINARY_DIR}/kdoctools/meinproc )
  1003. set( KDE3_KCFGC_EXECUTABLE ${CMAKE_BINARY_DIR}/tdecore/tdeconfig_compiler/tdeconfig_compiler )
  1004. ##### global compiler settings ##################
  1005. add_definitions(
  1006. -DHAVE_CONFIG_H
  1007. )
  1008. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
  1009. set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
  1010. set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )
  1011. ##### headers ###################################
  1012. install( FILES
  1013. tde.pot
  1014. DESTINATION ${INCLUDE_INSTALL_DIR} )
  1015. ##### pkg-config #################################
  1016. execute_process(
  1017. COMMAND awk "/^#define TDE_VERSION_MAJOR/,/^#define TDE_VERSION_RELEASE/{ v[++i]=$3 }; END { print v[1]\".\"v[2]\".\"v[3] };"
  1018. INPUT_FILE ${CMAKE_SOURCE_DIR}/tdecore/tdeversion.h
  1019. OUTPUT_VARIABLE TDE_RELEASE_NUM
  1020. OUTPUT_STRIP_TRAILING_WHITESPACE )
  1021. configure_file( tdelibs.pc.cmake tdelibs.pc @ONLY )
  1022. install( FILES ${CMAKE_CURRENT_BINARY_DIR}/tdelibs.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
  1023. ##### subdirectories ############################
  1024. add_subdirectory( dcop )
  1025. add_subdirectory( libltdl )
  1026. add_subdirectory( kglib )
  1027. add_subdirectory( tdefx )
  1028. add_subdirectory( tdecore )
  1029. if( WITH_ELFICON )
  1030. add_subdirectory( tdelfeditor )
  1031. endif( WITH_ELFICON )
  1032. add_subdirectory( tdeunittest )
  1033. add_subdirectory( tdeui )
  1034. add_subdirectory( tdesu )
  1035. add_subdirectory( kjs )
  1036. add_subdirectory( tdewallet )
  1037. add_subdirectory( tdeio )
  1038. add_subdirectory( kded )
  1039. # FIXME this directory/target doesn't exists
  1040. # add_subdirectory( kded_post )
  1041. add_subdirectory( kdoctools )
  1042. add_subdirectory( doc )
  1043. add_subdirectory( tdeparts )
  1044. add_subdirectory( tdeutils )
  1045. add_subdirectory( tdespell2 )
  1046. add_subdirectory( tdemdi )
  1047. add_subdirectory( tdeinit )
  1048. add_subdirectory( tdeprint )
  1049. add_subdirectory( kab )
  1050. add_subdirectory( tderesources )
  1051. add_subdirectory( tdeabc )
  1052. add_subdirectory( arts )
  1053. add_subdirectory( interfaces )
  1054. add_subdirectory( kate )
  1055. add_subdirectory( tdecert )
  1056. tde_conditional_add_subdirectory( WITH_XRANDR tderandr )
  1057. add_subdirectory( tdehtml )
  1058. add_subdirectory( tdecmshell )
  1059. add_subdirectory( tdeconf_update )
  1060. add_subdirectory( tdewidgets )
  1061. add_subdirectory( kimgio )
  1062. add_subdirectory( tdeioslave )
  1063. add_subdirectory( tdestyles )
  1064. add_subdirectory( libtdemid )
  1065. add_subdirectory( libtdescreensaver )
  1066. add_subdirectory( networkstatus )
  1067. add_subdirectory( tdenewstuff )
  1068. add_subdirectory( tdersync )
  1069. add_subdirectory( licenses )
  1070. add_subdirectory( dnssd )
  1071. add_subdirectory( pics )
  1072. add_subdirectory( mimetypes )
  1073. add_subdirectory( tdefile-plugins )
  1074. ##### install import cmake modules ###############
  1075. tde_install_export( )