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

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