TDE core libraries
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

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