tdebase
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

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