TDE core libraries
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

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