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

470 lines
13KB

  1. #################################################
  2. #
  3. # (C) 2010-2012 Serghei Amelian
  4. # serghei (DOT) amelian (AT) gmail.com
  5. #
  6. # (C) 2014 Timothy Pearson
  7. # kb9vqf (AT) pearsoncomputing (DOT) net
  8. #
  9. # Improvements and feedback are welcome
  10. #
  11. # This file is released under GPL >= 2
  12. #
  13. #################################################
  14. # required stuff
  15. tde_setup_architecture_flags( )
  16. include(TestBigEndian)
  17. test_big_endian(WORDS_BIGENDIAN)
  18. tde_setup_largefiles( )
  19. find_package( TQt )
  20. find_package( TDE )
  21. ##### check for libdl ###########################
  22. set( DL_LIBRARIES dl )
  23. check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )
  24. if( NOT HAVE_LIBDL )
  25. unset( DL_LIBRARIES )
  26. check_function_exists( dlopen HAVE_DLOPEN )
  27. if( HAVE_DLOPEN )
  28. set( HAVE_LIBDL 1 )
  29. endif( HAVE_DLOPEN )
  30. endif( NOT HAVE_LIBDL )
  31. # stdint.h (drkonqi)
  32. if( BUILD_DRKONQI )
  33. check_include_file( stdint.h HAVE_STDINT_H )
  34. endif( )
  35. # termios.h (tdm, tdeioslave)
  36. if( BUILD_TDM OR BUILD_TDEIOSLAVES )
  37. check_include_file( termios.h HAVE_TERMIOS_H )
  38. endif( )
  39. # sys/bitypes.h (drkonqi)
  40. if( BUILD_DRKONQI )
  41. check_include_file( sys/bitypes.h HAVE_SYS_BITYPES_H )
  42. endif( )
  43. # sys/ioctl.h (tdeioslave/fish, kcontrol/info)
  44. if( BUILD_TDEIOSLAVES OR BUILD_KCONTROL )
  45. check_include_file( sys/ioctl.h HAVE_SYS_IOCTL_H )
  46. endif( )
  47. # sys/types.h (drkonqi, tdeioslave/smtp)
  48. if( BUILD_DRKONQI OR BUILD_TDEIOSLAVES )
  49. check_include_file( sys/types.h HAVE_SYS_TYPES_H )
  50. endif( )
  51. # sys/time.h (tdeioslave/sftp, ksmserver, ksplashml)
  52. if( BUILD_KSMSERVER OR BUILD_KSPLASHML OR BUILD_TDEIOSLAVES)
  53. check_include_file( sys/time.h HAVE_SYS_TIME_H )
  54. endif( )
  55. # pam
  56. if( WITH_PAM AND (BUILD_KCHECKPASS OR BUILD_TDM) )
  57. check_library_exists( pam pam_start "" HAVE_PAM )
  58. if( HAVE_PAM )
  59. check_include_file( "security/pam_appl.h" SECURITY_PAM_APPL_H )
  60. endif( )
  61. if( HAVE_PAM AND SECURITY_PAM_APPL_H )
  62. set( PAM_LIBRARY pam ${DL_LIBRARIES} )
  63. else( )
  64. tde_message_fatal( "pam are requested, but not found on your system" )
  65. endif( )
  66. endif( )
  67. # crypt
  68. set( CRYPT_LIBRARY crypt )
  69. check_library_exists( ${CRYPT_LIBRARY} crypt "" HAVE_CRYPT )
  70. if( NOT HAVE_CRYPT )
  71. unset( CRYPT_LIBRARY )
  72. check_function_exists( crypt LIBC_HAVE_CRYPT )
  73. if( LIBC_HAVE_CRYPT )
  74. set( HAVE_CRYPT 1 CACHE INTERNAL "" FORCE )
  75. endif( LIBC_HAVE_CRYPT )
  76. endif( NOT HAVE_CRYPT )
  77. # hal (ksmserver, tdeioslaves)
  78. if( WITH_HAL )
  79. pkg_search_module( HAL hal )
  80. if( NOT HAL_FOUND )
  81. tde_message_fatal( "hal is required, but was not found on your system" )
  82. endif( )
  83. endif( )
  84. # tdehwlib (drkonqi, kcontrol, kicker, ksmserver, tdeioslaves, tdm)
  85. if( WITH_TDEHWLIB )
  86. tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" )
  87. check_cxx_source_compiles( "
  88. #include <kdemacros.h>
  89. #ifndef __TDE_HAVE_TDEHWLIB
  90. #error tdecore is not build with tdehwlib
  91. #endif
  92. int main() { return 0; } "
  93. HAVE_TDEHWLIB
  94. )
  95. tde_restore( CMAKE_REQUIRED_INCLUDES )
  96. if( NOT HAVE_TDEHWLIB )
  97. tde_message_fatal( "tdehwlib is required, but not built in tdecore" )
  98. endif( NOT HAVE_TDEHWLIB )
  99. endif( )
  100. # udev (tsak)
  101. if( BUILD_TSAK )
  102. pkg_search_module( UDEV udev )
  103. if( NOT UDEV_FOUND )
  104. tde_message_fatal( "udev is required, but was not found on your system" )
  105. endif( )
  106. endif( )
  107. ##### check for gcc visibility support #########
  108. if( WITH_GCC_VISIBILITY )
  109. tde_setup_gcc_visibility( )
  110. endif( )
  111. # xrender (kdesktop, konsole, kcontrol, kicker, twin)
  112. if( WITH_XRENDER OR BUILD_KDESKTOP OR BUILD_KONSOLE OR BUILD_KCONTROL OR BUILD_KICKER )
  113. pkg_search_module( XRENDER xrender )
  114. if( XRENDER_FOUND )
  115. set( HAVE_XRENDER 1 )
  116. elseif( WITH_XRENDER )
  117. tde_message_fatal( "xrender is requested, but was not found on your system" )
  118. endif( )
  119. endif( )
  120. # xrandr (kcontrol, twin/compot-tde)
  121. if( WITH_XRANDR )
  122. pkg_search_module( XRANDR xrandr )
  123. if( NOT XRANDR_FOUND )
  124. tde_message_fatal( "xrandr are requested, but not found on your system" )
  125. endif( )
  126. endif( )
  127. # xinerama (ksplashml, twin/compot-tde)
  128. if( WITH_XINERAMA )
  129. pkg_search_module( XINERAMA xinerama )
  130. if( XINERAMA_FOUND )
  131. set( HAVE_XINERAMA 1 )
  132. else( )
  133. tde_message_fatal( "xinerama is requested, but not found on your system" )
  134. endif( )
  135. endif( WITH_XINERAMA )
  136. # xcursor (tdeioslave, kcontrol)
  137. if( WITH_XCURSOR )
  138. pkg_search_module( XCURSOR xcursor )
  139. if( XCURSOR_FOUND )
  140. set( HAVE_XCURSOR 1 )
  141. else( )
  142. tde_message_fatal( "xcursor is requested, but was not found on your system" )
  143. endif( )
  144. endif( )
  145. # xcomposite (kicker, twin)
  146. if( WITH_XCOMPOSITE )
  147. pkg_search_module( XCOMPOSITE xcomposite )
  148. if( XCOMPOSITE_FOUND )
  149. set( HAVE_XCOMPOSITE 1 )
  150. else( XCOMPOSITE_FOUND )
  151. tde_message_fatal( "xcomposite is requested, but was not found on your system" )
  152. endif( XCOMPOSITE_FOUND )
  153. # xdamage (twin/kompmgr)
  154. pkg_search_module( XDAMAGE xdamage )
  155. if( NOT XDAMAGE_FOUND )
  156. tde_message_fatal( "xdamage is required for xcomposite support, but was not found on your system" )
  157. endif( )
  158. # xext (twin/kompmgr)
  159. pkg_search_module( XEXT xext )
  160. if( NOT XEXT_FOUND )
  161. tde_message_fatal( "xext is required for xcomposite support, but was not found on your system" )
  162. endif( )
  163. # for (twin/compton)
  164. # older libXext (e.g.in debian-6.0) doesn't provide XSyncFence
  165. tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${XEXT_INCLUDE_DIRS}" )
  166. tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "${XEXT_LIBRARIES}" )
  167. check_symbol_exists( "XSyncCreateFence" "X11/Xlib.h;X11/extensions/sync.h" HAVE_XEXT_XSYNCFENCE )
  168. tde_restore( CMAKE_REQUIRED_LIBRARIES )
  169. tde_restore( CMAKE_REQUIRED_INCLUDES )
  170. endif( )
  171. # xfixes (klipper, kicker)
  172. if( WITH_XFIXES )
  173. pkg_search_module( XFIXES xfixes )
  174. if( XFIXES_FOUND )
  175. set( HAVE_XFIXES 1 CACHE INTERNAL "" FORCE )
  176. else( )
  177. tde_message_fatal( "xfixes is requested, but was not found on your system" )
  178. endif( )
  179. endif( )
  180. # libconfig (twin/compton-tde)
  181. if( WITH_LIBCONFIG )
  182. pkg_search_module( LIBCONFIG libconfig )
  183. if( LIBCONFIG_FOUND )
  184. set( HAVE_LIBCONFIG 1 )
  185. # TODO replace with functionality check
  186. if( LIBCONFIG_VERSION VERSION_LESS 1.4.0 )
  187. set( HAVE_LIBCONFIG_OLD_API 1 )
  188. endif( )
  189. else( LIBCONFIG_FOUND )
  190. tde_message_fatal( "libconfig is requested, but was not found on your system" )
  191. endif( )
  192. endif( )
  193. # pcre (twin/compton-tde)
  194. if( WITH_PCRE )
  195. pkg_search_module( LIBPCRE libpcre )
  196. if( NOT LIBPCRE_FOUND )
  197. tde_message_fatal( "pcre support is requested, but not found on your system" )
  198. endif( NOT LIBPCRE_FOUND )
  199. endif( )
  200. # xtest (kxkb)
  201. if( WITH_XTEST )
  202. pkg_search_module( XTEST xtst )
  203. if( XTEST_FOUND )
  204. set( HAVE_XTEST 1 )
  205. else( XTEST_FOUND )
  206. tde_message_fatal( "xtest is requested, but was not found on your system" )
  207. endif( )
  208. endif( )
  209. # xscreensaver ()
  210. if( WITH_XSCREENSAVER )
  211. check_library_exists( Xss XScreenSaverQueryInfo "" HAVE_XSSLIB )
  212. if( HAVE_XSSLIB )
  213. pkg_search_module( XSS xscrnsaver )
  214. else( )
  215. check_library_exists( Xext XScreenSaverQueryInfo "" HAVE_XEXT_XSS )
  216. if( HAVE_XEXT_XSS )
  217. set( HAVE_XSSLIB 1 )
  218. pkg_search_module( XSS xext )
  219. endif( )
  220. endif( )
  221. check_include_file( X11/extensions/scrnsaver.h HAVE_XSCREENSAVER_H )
  222. if( HAVE_XSSLIB AND HAVE_XSCREENSAVER_H )
  223. set( HAVE_XSCREENSAVER 1 )
  224. else( )
  225. tde_message_fatal( "xscreensaver is requested, but was not found on your system" )
  226. endif( )
  227. # We don't really need the xscreensaver package for building, we only need to know
  228. # where xscreensaver stores its executables. So give the user the possibility
  229. # to define XSCREENSAVER_DIR and speficy the location manually.
  230. include( FindXscreensaver.cmake ) # not really good practise
  231. if( NOT XSCREENSAVER_DIR )
  232. tde_message_fatal(
  233. "xscreensaver is requested, but cmake can not determine the location of XSCREENSAVER_DIR
  234. You have to either specify it manually with e.g. -DXSCREENSAVER_DIR=/usr/lib/misc/xscreensaver/
  235. or make sure that xscreensaver installed properly" )
  236. endif( )
  237. endif( )
  238. # openGL (kdesktop or kcontrol or tdescreensaver or twin/compot-tde )
  239. if( WITH_OPENGL )
  240. pkg_search_module( GL gl )
  241. if( GL_FOUND )
  242. # some extra check, stricktly speaking they are not necessary
  243. tde_save( CMAKE_REQUIRED_LIBRARIES )
  244. set( CMAKE_REQUIRED_LIBRARIES ${GL_LIBRARIES} )
  245. check_symbol_exists( glXChooseVisual "GL/glx.h" HAVE_GLXCHOOSEVISUAL )
  246. tde_restore( CMAKE_REQUIRED_LIBRARIES )
  247. if( NOT HAVE_GLXCHOOSEVISUAL )
  248. tde_message_fatal( "opengl is requested and found, but it doesn't provides glXChooseVisual() or GL/glx.h" )
  249. endif( )
  250. else( )
  251. check_library_exists( GL glXChooseVisual "" HAVE_GLXCHOOSEVISUAL )
  252. if( HAVE_GLXCHOOSEVISUAL )
  253. set( GL_LIBRARIES "GL" )
  254. else( HAVE_GLXCHOOSEVISUAL )
  255. tde_message_fatal( "opengl is requested, but not found on your system" )
  256. endif( HAVE_GLXCHOOSEVISUAL )
  257. endif( )
  258. if( BUILD_KCONTROL )
  259. pkg_search_module( GLU glu )
  260. if( NOT GLU_FOUND )
  261. check_library_exists( GLU gluGetString "" HAVE_GLUGETSTRING )
  262. if( HAVE_GLUGETSTRING )
  263. set( GLU_LIBRARIES "GLU" )
  264. else( HAVE_GLUGETSTRING )
  265. tde_message_fatal( "glu is required, but not found on your system" )
  266. endif( HAVE_GLUGETSTRING )
  267. endif( )
  268. endif( BUILD_KCONTROL )
  269. endif( )
  270. # glib-2.0
  271. if( BUILD_NSPLUGINS )
  272. pkg_search_module( GLIB2 glib-2.0 )
  273. if( NOT GLIB2_FOUND )
  274. tde_message_fatal( "glib-2.0 are required, but not found on your system" )
  275. endif( )
  276. endif( )
  277. # kde_socklen_t
  278. if( BUILD_TDEIOSLAVES OR BUILD_KSYSGUARD )
  279. set( kde_socklen_t socklen_t )
  280. endif( )
  281. # getifaddrs (kcontrol, tdm)
  282. if( BUILD_KCONTROL OR BUILD_TDM )
  283. check_function_exists( getifaddrs HAVE_GETIFADDRS )
  284. endif( )
  285. # xkb (konsole, tdm, kxkb)
  286. if( BUILD_KONSOLE OR BUILD_TDM OR BUILD_KXKB )
  287. check_include_file( X11/XKBlib.h HAVE_X11_XKBLIB_H )
  288. if( HAVE_X11_XKBLIB_H )
  289. check_library_exists( X11 XkbLockModifiers "" HAVE_XKB )
  290. if( BUILD_TDM )
  291. check_library_exists( X11 XkbSetPerClientControls "" HAVE_XKBSETPERCLIENTCONTROLS )
  292. endif( )
  293. endif( )
  294. endif( )
  295. # XBINDIR, XLIBDIR (tdm, kxkb)
  296. if( BUILD_TDM OR BUILD_KXKB )
  297. find_program( some_x_program NAMES iceauth xrdb xterm )
  298. if( NOT some_x_program )
  299. set( some_x_program /usr/bin/xrdb )
  300. message( STATUS "Warning: Could not determine X binary directory. Assuming /usr/bin." )
  301. endif( )
  302. get_filename_component( proto_xbindir "${some_x_program}" PATH )
  303. get_filename_component( XBINDIR "${proto_xbindir}" ABSOLUTE )
  304. get_filename_component( xrootdir "${XBINDIR}" PATH )
  305. set( XBINDIR ${XBINDIR} CACHE INTERNAL "" FORCE )
  306. set( XLIBDIR "${xrootdir}/lib/X11" CACHE INTERNAL "" FORCE )
  307. endif( )
  308. # arts
  309. if( WITH_ARTS )
  310. pkg_search_module( ARTS arts )
  311. if( NOT ARTS_FOUND )
  312. message( FATAL_ERROR "\naRts is requested, but was not found on your system" )
  313. endif( )
  314. else( )
  315. set( WITHOUT_ARTS 1 )
  316. endif( )
  317. # libart
  318. if( WITH_LIBART )
  319. pkg_search_module( LIBART libart-2.0 )
  320. if( NOT LIBART_FOUND )
  321. message(FATAL_ERROR "\nlibart-2.0 support are requested, but not found on your system" )
  322. endif( NOT LIBART_FOUND )
  323. set( HAVE_LIBART 1 )
  324. endif( WITH_LIBART )
  325. # dbus (tdm, kdesktop, twin/compton-tde.c)
  326. if( BUILD_TDM OR BUILD_KDESKTOP OR (BUILD_TWIN AND WITH_XCOMPOSITE) )
  327. pkg_search_module( DBUS dbus-1 )
  328. if( NOT DBUS_FOUND )
  329. tde_message_fatal( "dbus-1 is required, but was not found on your system" )
  330. endif( )
  331. endif( )
  332. # dbus-1-tqt (kdesktop)
  333. if( BUILD_KDESKTOP )
  334. pkg_search_module( DBUS_1_TQT dbus-1-tqt )
  335. if( NOT DBUS_1_TQT_FOUND )
  336. tde_message_fatal( "dbus-1-tqt is required, but was not found on your system" )
  337. endif( )
  338. endif( )
  339. # dbus-tqt (ksmserver, kicker, tdeioslaves(media))
  340. if( WITH_HAL AND (BUILD_KSMSERVER OR BUILD_KICKER OR BUILD_TDEIOSLAVES) )
  341. # check for dbus-tqt
  342. # dbus-tqt need Qt flags
  343. pkg_check_modules( DBUS_TQT REQUIRED dbus-tqt )
  344. tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
  345. set( CMAKE_REQUIRED_INCLUDES ${DBUS_TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS})
  346. set( CMAKE_REQUIRED_LIBRARIES ${DBUS_TQT_LDFLAGS} ${TQT_LDFLAGS} ${QT_LDFLAGS} )
  347. check_cxx_source_compiles("
  348. #include <tqt.h>
  349. #include <dbus/connection.h>
  350. int main(int, char**) { return 0; } "
  351. HAVE_DBUS_QT3_07 )
  352. tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
  353. if( NOT HAVE_DBUS_QT3_07 )
  354. tde_message_fatal( "dbus-tqt is required, but was not found on your system" )
  355. endif( )
  356. endif( )
  357. # check for krb5
  358. if( WITH_KRB5 )
  359. pkg_search_module( KRB5 krb5 )
  360. if( NOT KRB5_FOUND )
  361. check_include_file( kadm5/admin.h HAVE_KRB_KADM_H )
  362. if( NOT HAVE_KRB_KADM_H )
  363. message(FATAL_ERROR "\nKerberos support was requested, but krb5 was not found on your system" )
  364. endif( NOT HAVE_KRB_KADM_H )
  365. endif( NOT KRB5_FOUND )
  366. set( HAVE_KRB5 1 )
  367. set( LIBTDELDAP_LIBRARIES "tdeldap" )
  368. endif( )
  369. # check for libr
  370. if( WITH_ELFICON )
  371. pkg_search_module( LIBR libr )
  372. if( NOT LIBR_FOUND )
  373. message(FATAL_ERROR "\nelficon support was requested, but libr was not found on your system" )
  374. endif( NOT LIBR_FOUND )
  375. if( NOT "${LIBR_VERSION}" STREQUAL "0.6.0" )
  376. message(FATAL_ERROR "\nelficon support was requested, but the libr version on your system may not be compatible with TDE" )
  377. endif( NOT "${LIBR_VERSION}" STREQUAL "0.6.0" )
  378. set( HAVE_ELFICON 1 )
  379. endif( )