TDE core libraries
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

CMakeLists.txt 44KB

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