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.

ConfigureChecks.cmake 13KB

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