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

CMakeLists.txt 44KB

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