TDE core libraries
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

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