TDE core libraries
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CMakeLists.txt 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  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 "3.5.13" )
  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. find_package( TQt )
  34. ##### add apidox targets ############
  35. add_custom_target(apidox
  36. COMMAND "./generate_apidox" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${HTML_INSTALL_DIR}" "/usr/share/qt3/doc/html"
  37. WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake/")
  38. add_custom_target(install-apidox
  39. COMMAND "./install_apidox" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${HTML_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}"
  40. WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake/")
  41. ##### user requested options ####################
  42. OPTION( WITH_ALL_OPTIONS "Enable all optional support" OFF )
  43. OPTION( TDE_MALLOC "Use own malloc implementation" OFF )
  44. OPTION( TDE_MALLOC_DEBUG "Enable debugging in fast malloc" OFF )
  45. OPTION( TDE_MALLOC_FULL "Make alloc as fast as possible" OFF )
  46. OPTION( WITH_ARTS "Build with aRts" ON )
  47. OPTION( WITH_ALSA "Enable ALSA support" ON )
  48. OPTION( WITH_LIBART "Enable libart support (for SVG icons)" ${WITH_ALL_OPTIONS} )
  49. OPTION( WITH_LIBIDN "Enable support for libidn" ${WITH_ALL_OPTIONS} )
  50. OPTION( WITH_SSL "Enable support for SSL" ON )
  51. OPTION( WITH_CUPS "Enable CUPS support" ON )
  52. OPTION( WITH_LUA "Enable LUA support" ${WITH_ALL_OPTIONS} )
  53. OPTION( WITH_TIFF "Enable tiff support" ${WITH_ALL_OPTIONS} )
  54. OPTION( WITH_JASPER "Enable jasper (jpeg2k) support" ${WITH_ALL_OPTIONS} )
  55. OPTION( WITH_OPENEXR "Enable openexr support" ${WITH_ALL_OPTIONS} )
  56. OPTION( WITH_UTEMPTER "Use utempter for utmp management" ${WITH_ALL_OPTIONS} )
  57. OPTION( WITH_AVAHI "Enable AVAHI support" ${WITH_ALL_OPTIONS} )
  58. OPTION( WITH_ELFICON "Enable ELF embedded icon support" ${WITH_ALL_OPTIONS} )
  59. OPTION( WITH_PCRE "Enable pcre regex support for kjs" ON )
  60. OPTION( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
  61. OPTION( WITH_INOTIFY "Enable inotify support for tdeio" ON )
  62. OPTION( WITH_GAMIN "Enable FAM/GAMIN support" ${WITH_ALL_OPTIONS} )
  63. option( WITH_UPOWER "Enable UPOWER support" ${WITH_ALL_OPTIONS} )
  64. OPTION( WITH_NETWORK_MANAGER_BACKEND "Enable network-manager support" OFF )
  65. OPTION( WITH_SUDO_TDESU_BACKEND "Use sudo as backend for tdesu (default is su)" OFF )
  66. OPTION( WITH_ASPELL "Enable aspell support" ${WITH_ALL_OPTIONS} )
  67. OPTION( WITH_HSPELL "Enable hspell support" ${WITH_ALL_OPTIONS} )
  68. ##### set PKG_CONFIG_PATH #######################
  69. set( ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:${PKGCONFIG_INSTALL_DIR}:${LIB_INSTALL_DIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}" )
  70. ##### check for CPU architecture ################
  71. ### FIXME fast malloc is also available on x86_64 architecture?
  72. if( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i?86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" )
  73. set( TDE_MALLOC_X86 1 )
  74. message( STATUS "Found x86 architecture" )
  75. else( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i?86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" )
  76. if( TDE_MALLOC )
  77. message( FATAL_ERROR "\nKDE fast malloc is available only on x86 architecture" )
  78. endif( TDE_MALLOC )
  79. endif( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i?86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" )
  80. ##### check for operating system ################
  81. if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
  82. set( TDEINIT_SETUID 1 )
  83. set( TDEINIT_OOM_PROTECT 1 )
  84. endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
  85. ##### check for compiler capabilities ###########
  86. include( CheckCXXCompilerFlag )
  87. check_cxx_compiler_flag( -Woverloaded-virtual WOVERLOADED_VIRTUAL )
  88. if( WOVERLOADED_VIRTUAL )
  89. set( WOVERLOADED_VIRTUAL -Woverloaded-virtual )
  90. endif( WOVERLOADED_VIRTUAL )
  91. check_cxx_compiler_flag( -fno-builtin NO_BUILTIN )
  92. if( NO_BUILTIN )
  93. endif( NO_BUILTIN )
  94. ##### system checks #############################
  95. check_include_file( "ltdl.h" HAVE_LTDL_H )
  96. if( NOT HAVE_LTDL_H )
  97. tde_message_fatal( "ltdl.h are required, but not found on your system" )
  98. endif( )
  99. check_include_file( "alloca.h" HAVE_ALLOCA_H )
  100. check_include_file( "arpa/nameser8_compat.h" HAVE_ARPA_NAMESER8_COMPAT_H )
  101. check_include_file( "awe_voice.h" HAVE_AWE_VOICE_H )
  102. check_include_file( "Carbon/Carbon.h" HAVE_CARBON_CARBON_H )
  103. check_include_file( "crt_externs.h" HAVE_CRT_EXTERNS_H )
  104. check_include_file( "ctype.h" HAVE_CTYPE_H )
  105. check_include_file( "dirent.h" HAVE_DIRENT_H )
  106. check_include_file( "dld.h" HAVE_DLD_H )
  107. check_include_file( "dlfcn.h" HAVE_DLFCN_H )
  108. check_include_file( "dl.h" HAVE_DL_H )
  109. check_include_file( "float.h" HAVE_FLOAT_H )
  110. check_include_file( "fstab.h" HAVE_FSTAB_H )
  111. check_include_file( "ieeefp.h" HAVE_IEEEFP_H )
  112. check_include_file( "inttypes.h" HAVE_INTTYPES_H )
  113. check_include_file( "libutil.h" HAVE_LIBUTIL_H )
  114. check_include_file( "limits.h" HAVE_LIMITS_H )
  115. check_include_file( "linux/awe_voice.h" HAVE_LINUX_AWE_VOICE_H )
  116. check_include_file( "locale.h" HAVE_LOCALE_H )
  117. check_include_file( "machine/soundcard.h" HAVE_MACHINE_SOUNDCARD_H )
  118. check_include_file( "malloc.h" HAVE_MALLOC_H )
  119. check_include_file( "memory.h" HAVE_MEMORY_H )
  120. check_include_file( "mntent.h" HAVE_MNTENT_H )
  121. check_include_file( "ndir.h" HAVE_NDIR_H )
  122. check_include_file( "netinet/in.h" HAVE_NETINET_IN_H )
  123. check_include_file( "net/if.h" HAVE_NET_IF_H )
  124. check_include_file( "paths.h" HAVE_PATHS_H )
  125. check_include_file( "pty.h" HAVE_PTY_H )
  126. check_include_file( "stdint.h" HAVE_STDINT_H )
  127. check_include_file( "stdio.h" HAVE_STDIO_H )
  128. check_include_file( "stdlib.h" HAVE_STDLIB_H )
  129. check_include_file( "strings.h" HAVE_STRINGS_H )
  130. check_include_file( "string.h" HAVE_STRING_H )
  131. check_include_file( "sysent.h" HAVE_SYSENT_H )
  132. check_include_file( "sys/bitypes.h" HAVE_SYS_BITYPES_H )
  133. check_include_file( "sys/dir.h" HAVE_SYS_DIR_H )
  134. check_include_file( "sys/filio.h" HAVE_SYS_FILIO_H )
  135. check_include_file( "sys/mman.h" HAVE_SYS_MMAN_H )
  136. check_include_file( "sys/mntent.h" HAVE_SYS_MNTENT_H )
  137. check_include_file( "sys/mnttab.h" HAVE_SYS_MNTTAB_H )
  138. check_include_file( "sys/mount.h" HAVE_SYS_MOUNT_H )
  139. check_include_file( "sys/ndir.h" HAVE_SYS_NDIR_H )
  140. check_include_file( "sys/param.h" HAVE_SYS_PARAM_H )
  141. check_include_file( "sys/prctl.h" HAVE_SYS_PRCTL_H )
  142. check_include_file( "sys/select.h" HAVE_SYS_SELECT_H )
  143. check_include_file( "sys/soundcard.h" HAVE_SYS_SOUNDCARD_H )
  144. check_include_file( "sys/stat.h" HAVE_SYS_STAT_H )
  145. check_include_file( "sys/stropts.h" HAVE_SYS_STROPTS_H )
  146. check_include_file( "sys/types.h" HAVE_SYS_TYPES_H )
  147. check_include_file( "sys/ucred.h" HAVE_SYS_UCRED_H )
  148. check_include_file( "sys/xattr.h" sys/xattr.h )
  149. check_include_file( "termios.h" HAVE_TERMIOS_H )
  150. check_include_file( "termio.h" HAVE_TERMIO_H )
  151. check_include_file( "unistd.h" HAVE_UNISTD_H )
  152. check_include_file( "util.h" HAVE_UTIL_H )
  153. check_include_file( "values.h" HAVE_VALUES_H )
  154. # FIXME I'm not sure if test TIME_WITH_SYS_TIME are correct
  155. check_include_file( "sys/time.h" HAVE_SYS_TIME_H )
  156. check_include_file( "time.h" HAVE_TIME_H )
  157. if( HAVE_SYS_TIME_H AND HAVE_TIME_H )
  158. set( TIME_WITH_SYS_TIME 1 )
  159. endif( HAVE_SYS_TIME_H AND HAVE_TIME_H )
  160. check_include_file( "valgrind/memcheck.h" HAVE_VALGRIND_MEMCHECK_H )
  161. check_include_file( "values.h" HAVE_VALUES_H )
  162. check_include_file( "X11/extensions/shape.h" HAVE_X11_EXTENSIONS_SHAPE_H )
  163. check_include_file( "/usr/src/sys/gnu/i386/isa/sound/awe_voice.h" HAVE__USR_SRC_SYS_GNU_I386_ISA_SOUND_AWE_VOICE_H )
  164. check_include_file( "/usr/src/sys/i386/isa/sound/awe_voice.h" HAVE__USR_SRC_SYS_I386_ISA_SOUND_AWE_VOICE_H )
  165. check_function_exists( random HAVE_RANDOM )
  166. check_symbol_exists( random "stdlib.h" HAVE_RANDOM_PROTO )
  167. check_function_exists( srandom HAVE_SRANDOM )
  168. check_symbol_exists( srandom "stdlib.h" HAVE_SRANDOM_PROTO )
  169. check_function_exists( seteuid HAVE_SETEUID )
  170. check_function_exists( setegid HAVE_SETEGID )
  171. check_function_exists( gethostname HAVE_GETHOSTNAME )
  172. check_symbol_exists( gethostname "unistd.h" HAVE_GETHOSTNAME_PROTO )
  173. check_function_exists( vsnprintf HAVE_VSNPRINTF )
  174. check_function_exists( snprintf HAVE_SNPRINTF )
  175. check_function_exists( setenv HAVE_SETENV )
  176. check_symbol_exists( setenv "stdlib.h" HAVE_SETENV_PROTO )
  177. check_function_exists( unsetenv HAVE_UNSETENV )
  178. check_symbol_exists( unsetenv "stdlib.h" HAVE_UNSETENV_PROTO )
  179. check_function_exists( mkdtemp HAVE_MKDTEMP )
  180. check_symbol_exists( mkdtemp "stdlib.h" HAVE_MKDTEMP_PROTO )
  181. check_function_exists( mkstemp HAVE_MKSTEMP )
  182. check_symbol_exists( mkstemp "stdlib.h" HAVE_MKSTEMP_PROTO )
  183. check_function_exists( mkstemps HAVE_MKSTEMPS )
  184. check_symbol_exists( mkstemps "stdlib.h" HAVE_MKSTEMPS_PROTO )
  185. check_function_exists( initgroups HAVE_INITGROUPS )
  186. check_symbol_exists( initgroups "grp.h" HAVE_INITGROUPS_PROTO )
  187. check_function_exists( strlcat HAVE_STRLCAT )
  188. check_symbol_exists( strlcat "string.h" HAVE_STRLCAT_PROTO )
  189. check_function_exists( strlcpy HAVE_STRLCPY )
  190. check_symbol_exists( strlcpy "string.h" HAVE_STRLCPY_PROTO )
  191. check_symbol_exists( S_ISSOCK "sys/stat.h" HAVE_S_ISSOCK )
  192. check_symbol_exists( gethostbyname2 "netdb.h" HAVE_GETHOSTBYNAME2 )
  193. check_symbol_exists( gethostbyname2_r "netdb.h" HAVE_GETHOSTBYNAME2_R )
  194. check_symbol_exists( gethostbyname_r "netdb.h" HAVE_GETHOSTBYNAME_R )
  195. check_symbol_exists( gai_strerror "sys/types.h;sys/socket.h;netdb.h" HAVE_GAI_STRERROR )
  196. check_symbol_exists( getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO )
  197. check_function_exists( usleep HAVE_USLEEP )
  198. check_symbol_exists( usleep "unistd.h" HAVE_USLEEP_PROTO )
  199. check_function_exists( getmntinfo HAVE_GETMNTINFO )
  200. check_function_exists( getnameinfo HAVE_GETNAMEINFO )
  201. check_function_exists( getpagesize HAVE_GETPAGESIZE )
  202. check_function_exists( getpeereid HAVE_GETPEEREID )
  203. check_function_exists( getpeername HAVE_GETPEERNAME )
  204. check_function_exists( getprotobyname_r HAVE_GETPROTOBYNAME_R )
  205. check_function_exists( getpt HAVE_GETPT )
  206. check_function_exists( getservbyname_r HAVE_GETSERVBYNAME_R )
  207. check_function_exists( getservbyport_r HAVE_GETSERVBYPORT_R )
  208. check_function_exists( getsockname HAVE_GETSOCKNAME )
  209. check_function_exists( getsockopt HAVE_GETSOCKOPT )
  210. check_function_exists( gettimeofday HAVE_GETTIMEOFDAY )
  211. check_function_exists( grantpt HAVE_GRANTPT )
  212. check_function_exists( if_nametoindex HAVE_IF_NAMETOINDEX )
  213. check_function_exists( index HAVE_INDEX)
  214. check_function_exists( inet_ntop HAVE_INET_NTOP )
  215. check_function_exists( inet_pton HAVE_INET_PTON )
  216. check_function_exists( setfsent HAVE_SETFSENT )
  217. check_function_exists( setgroups HAVE_SETGROUPS )
  218. check_function_exists( setlocale HAVE_SETLOCALE )
  219. check_function_exists( setmntent HAVE_SETMNTENT )
  220. check_function_exists( setpriority HAVE_SETPRIORITY )
  221. check_function_exists( isnan HAVE_FUNC_ISNAN )
  222. check_function_exists( _finite HAVE_FUNC__FINITE )
  223. check_function_exists( finite HAVE_FUNC_FINITE )
  224. check_function_exists( isinf HAVE_FUNC_ISINF )
  225. check_function_exists( freeaddrinfo HAVE_FREEADDRINFO )
  226. check_function_exists( strtoll HAVE_STRTOLL )
  227. check_function_exists( socket HAVE_SOCKET )
  228. check_function_exists( strfmon HAVE_STRFMON )
  229. check_function_exists( stpcpy HAVE_STPCPY )
  230. check_function_exists( readdir_r HAVE_READDIR_R )
  231. check_function_exists( tcgetattr HAVE_TCGETATTR )
  232. check_function_exists( tcsetattr HAVE_TCSETATTR )
  233. check_function_exists( strcasecmp HAVE_STRCASECMP )
  234. check_function_exists( strchr HAVE_STRCHR )
  235. check_function_exists( strcmp HAVE_STRCMP )
  236. check_function_exists( strrchr HAVE_STRRCHR )
  237. check_function_exists( ptsname HAVE_PTSNAME )
  238. check_function_exists( unlockpt HAVE_UNLOCKPT )
  239. check_function_exists( _getpty HAVE__GETPTY )
  240. check_function_exists( __argz_count HAVE___ARGZ_COUNT )
  241. check_function_exists( __argz_next HAVE___ARGZ_NEXT )
  242. check_function_exists( __argz_stringify HAVE___ARGZ_STRINGIFY )
  243. check_function_exists( sendfile HAVE_SENDFILE )
  244. check_function_exists( rindex HAVE_RINDEX )
  245. check_function_exists( putenv HAVE_PUTENV )
  246. check_function_exists( poll HAVE_POLL )
  247. check_function_exists( memcpy HAVE_MEMCPY )
  248. check_function_exists( madvise HAVE_MADVISE )
  249. check_function_exists( getgroups HAVE_GETGROUPS )
  250. check_function_exists( getcwd HAVE_GETCWD )
  251. check_function_exists( dlerror HAVE_DLERROR )
  252. check_function_exists( crypt HAVE_CRYPT )
  253. check_function_exists( bcopy HAVE_BCOPY )
  254. check_function_exists( alloca HAVE_ALLOCA )
  255. check_function_exists( mmap HAVE_MMAP )
  256. check_function_exists( munmap HAVE_MUNMAP )
  257. check_type_size( "char*" SIZEOF_CHAR_P )
  258. check_type_size( "int" SIZEOF_INT )
  259. check_type_size( "long" SIZEOF_LONG )
  260. check_type_size( "short" SIZEOF_SHORT )
  261. check_type_size( "size_t" SIZEOF_SIZE_T )
  262. check_type_size( "unsigned long" SIZEOF_UNSIGNED_LONG )
  263. set( CMAKE_EXTRA_INCLUDE_FILES "netdb.h" )
  264. check_type_size( "struct addrinfo" STRUCT_ADDRINFO )
  265. set( CMAKE_EXTRA_INCLUDE_FILES "netinet/in.h" )
  266. check_type_size( "struct sockaddr_in6" HAVE_STRUCT_SOCKADDR_IN6 )
  267. unset( CMAKE_EXTRA_INCLUDE_FILES )
  268. check_c_source_compiles("
  269. #include <features.h>
  270. #ifndef __GNU_LIBRARY__
  271. #error
  272. #endif
  273. int main(int argc, char *argv[]) { return 0; } "
  274. _GNU_SOURCE )
  275. check_c_source_compiles("
  276. #include <unistd.h>
  277. int main(int argc, char *argv[]) { revoke(\"/dev/tty\"); return 0; } "
  278. HAVE_REVOKE )
  279. check_c_source_runs("
  280. #include <sys/types.h>
  281. #include <sys/socket.h>
  282. #include <netdb.h>
  283. #include <string.h>
  284. int main()
  285. {
  286. struct addrinfo hint, *res;
  287. int err;
  288. memset(&hint, 0, sizeof(hint));
  289. hint.ai_family = AF_INET;
  290. hint.ai_protocol = 0;
  291. hint.ai_socktype = SOCK_STREAM;
  292. hint.ai_flags = AI_PASSIVE;
  293. err = getaddrinfo(0, \"18300\", &hint, &res); /* kxmlrpc tries this */
  294. if (err != 0 || res == 0 || res->ai_family != AF_INET)
  295. return 1;
  296. return 0;
  297. }"
  298. HAVE_GOOD_GETADDRINFO
  299. )
  300. if( NOT HAVE_GOOD_GETADDRINFO )
  301. set( HAVE_BROKEN_GETADDRINFO 1 )
  302. endif( NOT HAVE_GOOD_GETADDRINFO )
  303. # save CMAKE_REQUIRED_LIBRARIES
  304. set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
  305. set( CMAKE_REQUIRED_LIBRARIES resolv )
  306. check_c_source_compiles("
  307. #include <sys/types.h>
  308. #include <netinet/in.h>
  309. #include <arpa/nameser.h>
  310. #include <resolv.h>
  311. int main(int argc, char *argv[]) { res_init(); return 0; } "
  312. HAVE_RES_INIT )
  313. if( HAVE_RES_INIT )
  314. set( RESOLV_LIBRARIES resolv )
  315. endif( HAVE_RES_INIT)
  316. set( CMAKE_REQUIRED_LIBRARIES util )
  317. check_c_source_runs("
  318. #include <pty.h>
  319. int main(int argc, char* argv) {
  320. int master_fd, slave_fd;
  321. int result;
  322. result = openpty(&master_fd, &slave_fd, 0, 0, 0);
  323. return 0;
  324. }"
  325. HAVE_OPENPTY
  326. )
  327. if( HAVE_OPENPTY )
  328. set( LIB_UTIL util )
  329. endif( )
  330. # restore CMAKE_REQUIRED_LIBRARIES
  331. set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
  332. unset( bak_CMAKE_REQUIRED_LIBRARIES )
  333. # FIXME for unknown reason cmake cannot find su
  334. #find_program( __PATH_SU su )
  335. set( __PATH_SU "/bin/su" )
  336. if( __PATH_SU )
  337. set( DEFAULT_SUPER_USER_COMMAND ${__PATH_SU} )
  338. else( __PATH_SU )
  339. message( STATUS "WARNING: su was not found" )
  340. endif( __PATH_SU )
  341. # FIXME for unknown reason cmake cannot find sudo
  342. # find_program( __PATH_SUDO "sudo" )
  343. set( __PATH_SUDO "/usr/bin/sudo" )
  344. if( WITH_SUDO_TDESU_BACKEND )
  345. if( __PATH_SUDO )
  346. set( DEFAULT_SUPER_USER_COMMAND ${__PATH_SUDO} )
  347. else( __PATH_SUDO )
  348. message( FATAL_ERROR "sudo was chosen as tdesu backend, but was not found in path." )
  349. endif( __PATH_SUDO )
  350. endif( WITH_SUDO_TDESU_BACKEND )
  351. #### set some constants #########################
  352. set( LTDL_OBJDIR \".\" )
  353. set( KDELIBSUFF "${LIB_SUFFIX}" )
  354. set( kde_socklen_t socklen_t )
  355. ##### check for libdl ###########################
  356. find_library( HAVE_LIBDL dl )
  357. if( NOT HAVE_LIBDL-NOTFOUND )
  358. set( DL_LIBRARIES dl )
  359. endif( NOT HAVE_LIBDL-NOTFOUND )
  360. ##### check for utempter ########################
  361. if( WITH_UTEMPTER )
  362. check_include_file( utempter.h HAVE_UTEMPTER_H )
  363. check_library_exists( utempter addToUtmp "" HAVE_ADDTOUTEMP )
  364. if( HAVE_UTEMPTER_H AND HAVE_ADDTOUTEMP )
  365. set( HAVE_UTEMPTER 1 )
  366. set( UTEMPTER_LIBRARY utempter )
  367. else( )
  368. message(FATAL_ERROR "\nutempter are requested, but not found on your system" )
  369. endif( )
  370. endif( )
  371. ##### check for zlib ############################
  372. find_package( ZLIB )
  373. if( NOT ZLIB_FOUND )
  374. message(FATAL_ERROR "\nzlib are required, but not found on your system" )
  375. endif( NOT ZLIB_FOUND )
  376. set( HAVE_LIBZ 1 )
  377. #### check for bzip2 ############################
  378. find_package( BZip2 )
  379. if( NOT BZIP2_FOUND )
  380. # FIXME I'm not sure if bzip2 are required; maybe is optional?
  381. message(FATAL_ERROR "\nbzip2 are required, but not found on your system" )
  382. endif( NOT BZIP2_FOUND )
  383. set( HAVE_BZIP2_SUPPORT 1 )
  384. if( BZIP2_NEED_PREFIX )
  385. set( NEED_BZ2_PREFIX 1 )
  386. endif( BZIP2_NEED_PREFIX )
  387. ##### check for jpeg ############################
  388. find_package( JPEG )
  389. if( NOT JPEG_FOUND )
  390. # FIXME I think jpeg support must be required
  391. message(FATAL_ERROR "\njpeg are required, but not found on your system" )
  392. endif( NOT JPEG_FOUND )
  393. set( HAVE_LIBJPEG 1 )
  394. ##### check for png #############################
  395. find_package( PNG )
  396. if( NOT PNG_FOUND )
  397. # FIXME I think png support must be required
  398. message(FATAL_ERROR "\npng are required, but not found on your system" )
  399. endif( NOT PNG_FOUND )
  400. set( HAVE_LIBPNG 1 )
  401. ##### check for tiff ############################
  402. if( WITH_TIFF )
  403. find_package( TIFF )
  404. if( NOT TIFF_FOUND )
  405. message(FATAL_ERROR "\ntiff are requested, but not found on your system" )
  406. endif( NOT TIFF_FOUND )
  407. set( HAVE_LIBTIFF 1)
  408. endif( WITH_TIFF )
  409. ##### check for jasper ##########################
  410. if( WITH_JASPER )
  411. find_package( Jasper )
  412. if( NOT JASPER_FOUND )
  413. message(FATAL_ERROR "\njasper are requested, but not found on your system" )
  414. endif( NOT JASPER_FOUND )
  415. set( HAVE_JASPER 1 )
  416. endif( WITH_JASPER )
  417. ##### check for openexr #########################
  418. if( WITH_OPENEXR )
  419. pkg_search_module( OPENEXR OpenEXR )
  420. if( NOT OPENEXR_FOUND )
  421. message(FATAL_ERROR "\nopenexr are requested, but not found on your system" )
  422. endif( NOT OPENEXR_FOUND )
  423. set( HAVE_EXR 1 )
  424. endif( WITH_OPENEXR )
  425. ##### check for freetype2 #######################
  426. pkg_search_module( FREETYPE freetype2 )
  427. if( NOT FREETYPE_FOUND )
  428. message(FATAL_ERROR "\nfreetype2 are required, but not found on your system" )
  429. endif( NOT FREETYPE_FOUND )
  430. set( TDEINIT_USE_FONTCONFIG 1 )
  431. ##### check for fontconfig ######################
  432. pkg_search_module( FONTCONFIG fontconfig )
  433. if( NOT FONTCONFIG_FOUND )
  434. message(FATAL_ERROR "\nfontconfig are required, but not found on your system" )
  435. endif( NOT FONTCONFIG_FOUND )
  436. ##### check for Xrandr ##########################
  437. pkg_search_module( XRANDR xrandr>=1.2 )
  438. if( XRANDR_FOUND )
  439. set( XRANDR_SUPPORT 1 )
  440. endif( XRANDR_FOUND )
  441. ##### check for xrender #########################
  442. pkg_search_module( XRENDER xrender )
  443. if( XRENDER_FOUND )
  444. set( HAVE_XRENDER 1 )
  445. endif( XRENDER_FOUND )
  446. ##### check for xcomposite #########################
  447. pkg_search_module( XCOMPOSITE xcomposite )
  448. if( XCOMPOSITE_FOUND )
  449. set( HAVE_XCOMPOSITE 1 )
  450. endif( XCOMPOSITE_FOUND )
  451. ##### check for libxml-2.0 ######################
  452. pkg_search_module( LIBXML2 libxml-2.0 )
  453. if( NOT LIBXML2_FOUND )
  454. message(FATAL_ERROR "\nlibxml-2.0 are required, but not found on your system" )
  455. endif( NOT LIBXML2_FOUND )
  456. ##### check for libxslt ######################
  457. pkg_search_module( LIBXSLT libxslt )
  458. if( NOT LIBXSLT_FOUND )
  459. message(FATAL_ERROR "\nlibxslt are required, but not found on your system" )
  460. endif( NOT LIBXSLT_FOUND )
  461. ##### check for glib-2.0 & friends ##############
  462. pkg_search_module( GLIB2 glib-2.0 )
  463. if( NOT GLIB2_FOUND )
  464. tde_message_fatal( "glib-2.0 are required, but not found on your system" )
  465. endif( )
  466. pkg_search_module( GOBJECT2 gobject-2.0 )
  467. if( NOT GLIB2_FOUND )
  468. tde_message_fatal( "gobject-2.0 are required, but not found on your system" )
  469. endif( )
  470. ##### check for ALSA ############################
  471. # FIXME I propose to drop support for very old ALSA versions (i.e 0.5)
  472. if( WITH_ALSA )
  473. find_package( ALSA )
  474. if( NOT ALSA_FOUND )
  475. message(FATAL_ERROR "\nALSA support are requested, but not found on your system" )
  476. endif( NOT ALSA_FOUND )
  477. set( HAVE_LIBASOUND2 1 )
  478. # FIXME I'm not sure if order is correct
  479. check_include_file( "alsa/asoundlib.h" HAVE_ALSA_ASOUNDLIB_H )
  480. if( NOT HAVE_ALSA_ASOUNDLIB_H )
  481. check_include_file( "sys/asoundlib.h" HAVE_SYS_ASOUNDLIB_H )
  482. endif( NOT HAVE_ALSA_ASOUNDLIB_H )
  483. endif( WITH_ALSA )
  484. ##### check for aRts ############################
  485. if( WITH_ARTS )
  486. pkg_search_module( ARTS arts )
  487. if( ARTS_FOUND )
  488. set( ARTS_MCOPIDL_EXECUTABLE ${ARTS_PREFIX}/bin/mcopidl )
  489. else( ARTS_FOUND )
  490. message(FATAL_ERROR "\naRts are requested, but not found on your system" )
  491. endif( ARTS_FOUND )
  492. else( WITH_ARTS )
  493. set( WITHOUT_ARTS 1 )
  494. endif( WITH_ARTS )
  495. ##### check for Xft #############################
  496. if( TDEINIT_USE_XFT )
  497. pkg_search_module( XFT xft )
  498. if( NOT XFT_FOUND )
  499. message(FATAL_ERROR "\nXft are required, but not found on your system" )
  500. endif( NOT XFT_FOUND )
  501. endif( TDEINIT_USE_XFT )
  502. ##### check for libart ##########################
  503. if( WITH_LIBART )
  504. pkg_search_module( LIBART libart-2.0 )
  505. if( NOT LIBART_FOUND )
  506. message(FATAL_ERROR "\nlibart-2.0 support are requested, but not found on your system" )
  507. endif( NOT LIBART_FOUND )
  508. set( HAVE_LIBART 1 )
  509. endif( WITH_LIBART )
  510. ##### check for libidn ##########################
  511. if( WITH_LIBIDN )
  512. pkg_search_module( LIBIDN libidn )
  513. if( NOT LIBIDN_FOUND )
  514. message(FATAL_ERROR "\nlibidn support are requested, but not found on your system" )
  515. endif( NOT LIBIDN_FOUND )
  516. set( HAVE_LIBIDN 1 )
  517. check_include_file( "idna.h" HAVE_IDNA_H )
  518. check_include_file( "punycode.h" HAVE_PUNYCODE_H )
  519. check_include_file( "stringprep.h" HAVE_STRINGPREP_H )
  520. endif( WITH_LIBIDN )
  521. ##### check for openssl #########################
  522. if( WITH_SSL )
  523. pkg_search_module( SSL openssl )
  524. if( NOT SSL_FOUND )
  525. message(FATAL_ERROR "\nSSL support are requested, but openssl is not found on your system" )
  526. endif( NOT SSL_FOUND )
  527. set( KSSL_HAVE_SSL 1 )
  528. set( HAVE_SSL 1 )
  529. endif( WITH_SSL )
  530. ##### check for cups ############################
  531. # FIXME CUPS must be at least 1.1.9
  532. if( WITH_CUPS )
  533. find_package( Cups )
  534. if( NOT CUPS_FOUND )
  535. message(FATAL_ERROR "\nCUPS support are requested, but not found on your system" )
  536. endif( NOT CUPS_FOUND )
  537. set( HAVE_CUPS 1 )
  538. # FIXME if CUPS is at least 1.1.20, doesn't have password caching
  539. set( HAVE_CUPS_NO_PWD_CACHE 1 )
  540. # save CMAKE_REQUIRED_LIBRARIES
  541. set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
  542. set( CMAKE_REQUIRED_LIBRARIES ${CUPS_LIBRARIES} )
  543. check_c_source_compiles("
  544. #include <cups/cups.h>
  545. #include <cups/ipp.h>
  546. #include <cups/language.h>
  547. int main(int argc, char *argv[]) { ipp_attribute_t *attr = 0; ippGetName(attr); return 0; } "
  548. HAVE_CUPS_1_6 )
  549. # restore CMAKE_REQUIRED_LIBRARIES
  550. set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
  551. unset( bak_CMAKE_REQUIRED_LIBRARIES )
  552. endif( WITH_CUPS )
  553. ##### check for LUA #############################
  554. if( WITH_LUA )
  555. message(FATAL_ERROR "\nLUA support are not ready yet" )
  556. pkg_search_module( LUA lua )
  557. if( NOT LUA_FOUND )
  558. message(FATAL_ERROR "\nLUA support are requested, but not found on your system" )
  559. endif( NOT LUA_FOUND )
  560. set( HAVE_LUA 1 )
  561. endif( WITH_LUA )
  562. ##### check for avahi ###########################
  563. if( WITH_AVAHI )
  564. if( WITH_QT4 )
  565. endif( WITH_QT4 )
  566. if( WITH_QT3 )
  567. pkg_search_module( AVAHI avahi-tqt )
  568. if( NOT AVAHI_FOUND )
  569. message(FATAL_ERROR "\navahi support are requested, but not found on your system" )
  570. endif( NOT AVAHI_FOUND )
  571. set( AVAHI_API_0_6 1 )
  572. endif( WITH_QT3 )
  573. endif( )
  574. ##### check for libr ###########################
  575. # WARNING
  576. # before altering the LIBR_VERSION check,
  577. # please ensure that nothing changed in the
  578. # duplicated data definitions present in
  579. # tdeio/tdeio/tdefileitem.cpp
  580. if( WITH_ELFICON )
  581. pkg_search_module( LIBR libr )
  582. if( NOT LIBR_FOUND )
  583. message(FATAL_ERROR "\nelficon support was requested, but libr was not found on your system" )
  584. endif( NOT LIBR_FOUND )
  585. if( NOT "${LIBR_VERSION}" STREQUAL "0.6.0" )
  586. message(FATAL_ERROR "\nelficon support was requested, but the libr version on your system may not be compatible with TDE" )
  587. endif( NOT "${LIBR_VERSION}" STREQUAL "0.6.0" )
  588. set( HAVE_ELFICON 1 )
  589. endif( )
  590. ##### check for pcre ###########################
  591. if( WITH_PCRE )
  592. pkg_search_module( LIBPCRE libpcre )
  593. if( NOT LIBPCRE_FOUND )
  594. message(FATAL_ERROR "\npcre support are requested, but not found on your system" )
  595. endif( NOT LIBPCRE_FOUND )
  596. set( HAVE_PCREPOSIX 1 )
  597. endif( )
  598. ##### set DBUS file locations ##################
  599. if( NOT DEFINED DBUS_SYSTEM_CONF_DIRECTORY )
  600. set (DBUS_SYSTEM_CONF_DIRECTORY "/etc/dbus-1/system.d/" )
  601. message( STATUS "Using " ${DBUS_SYSTEM_CONF_DIRECTORY} " for DBUS configuration files" )
  602. endif( NOT DEFINED DBUS_SYSTEM_CONF_DIRECTORY )
  603. if( NOT DEFINED DBUS_SERVICE_DIRECTORY )
  604. set (DBUS_SERVICE_DIRECTORY "/usr/share/dbus-1/system-services/" )
  605. message( STATUS "Using " ${DBUS_SERVICE_DIRECTORY} " for DBUS service files" )
  606. endif( NOT DEFINED DBUS_SERVICE_DIRECTORY )
  607. if( WITH_NETWORK_MANAGER_BACKEND )
  608. ##### check for dbus-1 ###########################
  609. pkg_search_module( DBUS dbus-1 )
  610. if( NOT DBUS_FOUND )
  611. tde_message_fatal( "dbus-1 are required, but not found on your system" )
  612. endif( )
  613. ##### check for dbus-1-tqt ###########################
  614. pkg_search_module( DBUS_TQT dbus-1-tqt )
  615. if( DBUS_TQT_FOUND )
  616. find_program( DBUSXML2QT3_EXECUTABLE NAMES dbusxml2qt3 )
  617. else()
  618. tde_message_fatal( "dbus-1-tqt are required, but not found on your system" )
  619. endif( )
  620. ##### check for libnm-util ###########################
  621. pkg_search_module( NM_UTIL libnm-util )
  622. if( NOT NM_UTIL_FOUND )
  623. tde_message_fatal( "libnm-util are required, but not found on your system" )
  624. endif( )
  625. endif( WITH_NETWORK_MANAGER_BACKEND )
  626. ##### check for gcc visibility support #########
  627. # FIXME
  628. # This should check for [T]Qt3 visibility support
  629. if( WITH_GCC_VISIBILITY )
  630. if( NOT UNIX )
  631. message(FATAL_ERROR "\ngcc visibility support was requested, but your system is not *NIX" )
  632. endif( NOT UNIX )
  633. set( __KDE_HAVE_GCC_VISIBILITY 1 )
  634. set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
  635. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
  636. endif( )
  637. ##### check for inotify ###########################
  638. if( WITH_INOTIFY )
  639. check_include_file( "inotify.h" INOTIFY_FOUND )
  640. check_include_file( "sys/inotify.h" INOTIFY_SYS_FOUND )
  641. if( NOT INOTIFY_FOUND )
  642. if( NOT INOTIFY_SYS_FOUND )
  643. message(FATAL_ERROR "\ninotify support was requested, but inotify was not found on your system" )
  644. endif( NOT INOTIFY_SYS_FOUND )
  645. endif( NOT INOTIFY_FOUND )
  646. if( INOTIFY_FOUND )
  647. set( HAVE_INOTIFY 1 )
  648. endif( INOTIFY_FOUND )
  649. if( INOTIFY_SYS_FOUND )
  650. set( HAVE_INOTIFY 1 )
  651. set( HAVE_SYS_INOTIFY 1 )
  652. endif( INOTIFY_SYS_FOUND )
  653. endif( )
  654. ##### check for FAM/GAMIN ##########################
  655. if( WITH_GAMIN )
  656. check_include_file( "fam.h" HAVE_FAM_H )
  657. if( HAVE_FAM_H )
  658. pkg_search_module( GAMIN gamin )
  659. if( GAMIN_FOUND )
  660. set( HAVE_FAM 1 )
  661. else( GAMIN_FOUND )
  662. message(FATAL_ERROR "\nfam/gamin support was requested, but gamin was not found on your system" )
  663. endif( GAMIN_FOUND )
  664. else( HAVE_FAM_H )
  665. message(FATAL_ERROR "\nfam/gamin support was requested, but fam was not found on your system" )
  666. endif( HAVE_FAM_H )
  667. endif( WITH_GAMIN )
  668. ##### check for aspell ##########################
  669. # we need ASPELL_DATADIR too
  670. if( WITH_ASPELL )
  671. find_package( ASPELL )
  672. if( NOT ASPELL_FOUND )
  673. message(FATAL_ERROR "\nASPELL support are requested, but not found on your system" )
  674. endif( NOT ASPELL_FOUND )
  675. endif( WITH_ASPELL )
  676. ##### check for hspell ##########################
  677. if( WITH_HSPELL )
  678. find_package( HSPELL )
  679. if( NOT HSPELL_FOUND )
  680. message(FATAL_ERROR "\nHSPELL support are requested, but not found on your system" )
  681. endif( NOT HSPELL_FOUND )
  682. endif( WITH_HSPELL )
  683. ##### write configure files #####################
  684. configure_file( config.h.cmake config.h )
  685. configure_file( dcop/dcop-path.h.cmake dcop/dcop-path.h )
  686. configure_file( tdecore/kdemacros.h.cmake tdecore/kdemacros.h )
  687. configure_file( kjs/global.h.in kjs/global.h )
  688. configure_file( tdeio/kssl/ksslconfig.h.cmake tdeio/kssl/ksslconfig.h )
  689. configure_file( kdoctools/checkXML.cmake kdoctools/checkXML )
  690. ##### tools #####################################
  691. set( KDE3_DCOPIDL_EXECUTABLE ${CMAKE_BINARY_DIR}/dcop/dcopidl/dcopidl )
  692. set( KDE3_DCOPIDL2CPP_EXECUTABLE ${CMAKE_BINARY_DIR}/dcop/dcopidl2cpp/dcopidl2cpp )
  693. set( KDE3_MEINPROC_EXECUTABLE ${CMAKE_BINARY_DIR}/kdoctools/meinproc )
  694. set( KDE3_KCFGC_EXECUTABLE ${CMAKE_BINARY_DIR}/tdecore/tdeconfig_compiler/tdeconfig_compiler )
  695. ##### global compiler settings ##################
  696. add_definitions(
  697. -DHAVE_CONFIG_H
  698. )
  699. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
  700. set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
  701. set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )
  702. ##### headers ###################################
  703. install( FILES
  704. kde.pot
  705. DESTINATION ${INCLUDE_INSTALL_DIR} )
  706. ##### pkg-config #################################
  707. configure_file( tdelibs.pc.cmake tdelibs.pc @ONLY )
  708. install( FILES ${CMAKE_CURRENT_BINARY_DIR}/tdelibs.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
  709. ##### subdirectories ############################
  710. add_subdirectory( dcop )
  711. add_subdirectory( libltdl )
  712. add_subdirectory( kglib )
  713. add_subdirectory( tdefx )
  714. add_subdirectory( tdecore )
  715. if( WITH_ELFICON )
  716. add_subdirectory( tdelfeditor )
  717. endif( WITH_ELFICON )
  718. add_subdirectory( tdeunittest )
  719. add_subdirectory( tdeui )
  720. add_subdirectory( tdesu )
  721. add_subdirectory( kjs )
  722. add_subdirectory( tdewallet )
  723. add_subdirectory( tdeio )
  724. add_subdirectory( kded )
  725. # FIXME this directory/target doesn't exists
  726. # add_subdirectory( kded_post )
  727. add_subdirectory( kdoctools )
  728. add_subdirectory( doc )
  729. add_subdirectory( tdeparts )
  730. add_subdirectory( tdeutils )
  731. add_subdirectory( tdespell2 )
  732. add_subdirectory( tdemdi )
  733. add_subdirectory( kinit )
  734. add_subdirectory( tdeprint )
  735. add_subdirectory( kab )
  736. add_subdirectory( tderesources )
  737. add_subdirectory( tdeabc )
  738. add_subdirectory( arts )
  739. add_subdirectory( interfaces )
  740. add_subdirectory( kate )
  741. add_subdirectory( tdecert )
  742. if( XRANDR_FOUND )
  743. add_subdirectory( tderandr )
  744. endif( XRANDR_FOUND )
  745. add_subdirectory( tdehtml )
  746. add_subdirectory( tdecmshell )
  747. add_subdirectory( tdeconf_update )
  748. add_subdirectory( kdewidgets )
  749. add_subdirectory( kimgio )
  750. add_subdirectory( tdeioslave )
  751. add_subdirectory( kstyles )
  752. add_subdirectory( libtdemid )
  753. add_subdirectory( libtdescreensaver )
  754. add_subdirectory( networkstatus )
  755. add_subdirectory( knewstuff )
  756. add_subdirectory( tdersync )
  757. add_subdirectory( licenses )
  758. add_subdirectory( dnssd )
  759. add_subdirectory( pics )
  760. add_subdirectory( mimetypes )
  761. add_subdirectory( tdefile-plugins )
  762. ##### install import cmake modules ###############
  763. tde_install_export( )