tdepim
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 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. tde_setup_architecture_flags( )
  12. include(TestBigEndian)
  13. test_big_endian(WORDS_BIGENDIAN)
  14. tde_setup_largefiles( )
  15. ##### check for gcc visibility support #########
  16. if( WITH_GCC_VISIBILITY )
  17. tde_setup_gcc_visibility( )
  18. endif( )
  19. if( BUILD_KMAIL )
  20. check_include_file( "byteswap.h" HAVE_BYTESWAP_H )
  21. endif( )
  22. if( BUILD_LIBTDEPIM OR BUILD_KMAIL )
  23. option( TDEPIM_NEW_DISTRLISTS "Define if you want to use the new distribution lists" ON )
  24. endif( )
  25. if( BUILD_INDEXLIB OR BUILD_KMAIL )
  26. # check for stl coping with namespace std
  27. tde_save( CMAKE_CXX_FLAGS )
  28. string( REGEX REPLACE "-include tqt.h" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
  29. check_cxx_source_compiles("
  30. #include <iterator>
  31. struct s : public std::iterator<std::forward_iterator_tag, int> {};
  32. int main(int, char**) { return 0; } "
  33. HAVE_STLNAMESPACE )
  34. tde_restore( CMAKE_CXX_FLAGS )
  35. if( HAVE_STLNAMESPACE )
  36. set( STD_NAMESPACE_PREFIX "std::" )
  37. endif( )
  38. endif( )
  39. if( BUILD_KMOBILE )
  40. # FIXME not checked because Gentoo don't provide baudboy.h
  41. check_include_file( "baudboy.h" HAVE_BAUDBOY_H )
  42. endif( )
  43. if( WITH_GNOKII AND (BUILD_KADDRESSBOOK OR BUILD_KMOBILE) )
  44. pkg_search_module( GNOKII gnokii )
  45. if( NOT GNOKII_FOUND )
  46. tde_message_fatal( "gnokii are requested, but was not found on your system" )
  47. endif( )
  48. endif( )
  49. if( BUILD_LIBTDENETWORK OR BUILD_CERTMANAGER OR BUILD_KMAIL OR BUILD_KADDRESSBOOK OR BUILD_KONTACT )
  50. if( NOT HAVE_GPGME_0_4_BRANCH )
  51. message( STATUS "checking for 'gpgme'" )
  52. endif( )
  53. # find gpgme-config
  54. find_program( GPGME_EXECUTABLE NAMES gpgme-config )
  55. if( NOT GPGME_EXECUTABLE )
  56. tde_message_fatal( "gpgme-config was NOT found.\n gpgme library is installed?" )
  57. endif( )
  58. # find gpg-error-config
  59. find_program( GPG_ERR_EXECUTABLE NAMES gpg-error-config )
  60. if( NOT GPG_ERR_EXECUTABLE )
  61. tde_message_fatal( "gpg-error-config was NOT found.\n gpg-error library is installed?" )
  62. endif( )
  63. macro( __run_gpgme_config __type __var )
  64. execute_process(
  65. COMMAND ${GPGME_EXECUTABLE} --${__type}
  66. OUTPUT_VARIABLE ${__var}
  67. RESULT_VARIABLE __result
  68. OUTPUT_STRIP_TRAILING_WHITESPACE )
  69. if( _result )
  70. tde_message_fatal( "Unable to run ${GPGME_EXECUTABLE}!\n gpgme library incorrectly installed?\n Path to gpgme-config incorrect?" )
  71. endif( )
  72. endmacro( )
  73. macro( __run_gpgerr_config __type __var )
  74. execute_process(
  75. COMMAND ${GPG_ERR_EXECUTABLE} --${__type}
  76. OUTPUT_VARIABLE ${__var}
  77. RESULT_VARIABLE __result
  78. OUTPUT_STRIP_TRAILING_WHITESPACE )
  79. if( _result )
  80. tde_message_fatal( "Unable to run ${GPG_ERR_EXECUTABLE}!\n gpg-error library incorrectly installed?\n Path to gpgme-config are incorrect?" )
  81. endif( )
  82. endmacro( )
  83. __run_gpgme_config( version GPGME_VERSION )
  84. __run_gpgme_config( cflags GPGME_INCLUDE_DIRS )
  85. __run_gpgme_config( libs GPGME_LIBRARIES )
  86. __run_gpgerr_config( version GPGERR_VERSION )
  87. __run_gpgerr_config( cflags GPGERR_INCLUDE_DIRS )
  88. __run_gpgerr_config( libs GPGERR_LIBRARIES )
  89. # cleanup
  90. if( GPGME_INCLUDE_DIRS )
  91. string( REGEX REPLACE "(^| )-I" ";" GPGME_INCLUDE_DIRS "${GPGME_INCLUDE_DIRS}" )
  92. endif( )
  93. if( GPGME_LIBRARIES )
  94. string( REGEX REPLACE "(^| )-l" ";" GPGME_LIBRARIES "${GPGME_LIBRARIES}" )
  95. endif( )
  96. if( GPGERR_INCLUDE_DIRS )
  97. string( REGEX REPLACE "(^| )-I" ";" GPGERR_INCLUDE_DIRS "${GPGERR_INCLUDE_DIRS}" )
  98. endif( )
  99. if( GPGERR_LIBRARIES )
  100. string( REGEX REPLACE "(^| )-l" ";" GPGERR_LIBRARIES "${GPGERR_LIBRARIES}" )
  101. endif( )
  102. set( GPGME_INCLUDE_DIRS "${GPGME_INCLUDE_DIRS} ${GPGERR_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE )
  103. set( GPGME_LIBRARIES "${GPGME_LIBRARIES} ${GPGERR_LIBRARIES}" CACHE INTERNAL "" FORCE )
  104. string( REGEX REPLACE " ;" ";" GPGME_INCLUDE_DIRS "${GPGME_INCLUDE_DIRS}" )
  105. string( REGEX REPLACE " ;" ";" GPGME_LIBRARIES "${GPGME_LIBRARIES}" )
  106. set( GPGME_INCLUDE_DIRS "${GPGME_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE )
  107. set( GPGME_LIBRARIES "${GPGME_LIBRARIES}" CACHE INTERNAL "" FORCE )
  108. # assuming that all newer system have gpgme >= 0.4
  109. set( HAVE_GPGME_0_4_BRANCH 1 CACHE INTERNAL "" )
  110. # NOTE: assume we have largefile support (need for gpgme)
  111. # FIXME: to be sure, we must check it
  112. add_definitions( -D_FILE_OFFSET_BITS=64 )
  113. if( NOT HAVE_GPGME_0_4_BRANCH )
  114. message( STATUS " found 'gpgme', version ${GPGME_VERSION}" )
  115. endif( )
  116. # check for various GPGME features
  117. tde_save( CMAKE_CXX_FLAGS )
  118. tde_save( CMAKE_REQUIRED_LIBRARIES )
  119. string( REGEX REPLACE "-include tqt.h" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
  120. # See FIXME above regarding -D_FILE_OFFSET_BITS=64
  121. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GPGME_INCLUDE_DIRS} -D_FILE_OFFSET_BITS=64")
  122. set( CMAKE_REQUIRED_LIBRARIES "${GPGME_LIBRARIES}")
  123. # check for GPGME_KEYLIST_MODE_VALIDATE
  124. check_cxx_source_compiles("
  125. #include <gpgme.h>
  126. int main() {
  127. gpgme_keylist_mode_t mode = GPGME_KEYLIST_MODE_VALIDATE;
  128. };"
  129. HAVE_GPGME_KEYLIST_MODE_VALIDATE )
  130. # check for gpgme_cancel
  131. check_cxx_source_compiles("
  132. #include <gpgme.h>
  133. int main() {
  134. gpgme_ctx_t ctx = 0;
  135. gpgme_error_t e = gpgme_cancel( ctx );
  136. };"
  137. HAVE_GPGME_CANCEL )
  138. # check for gpgme_key_t->keylist_mode
  139. check_cxx_source_compiles("
  140. #include <gpgme.h>
  141. int main() {
  142. gpgme_key_t key = 0;
  143. key->keylist_mode = 0;
  144. };"
  145. HAVE_GPGME_KEY_T_KEYLIST_MODE )
  146. # check for gpgme_decrypt_result_t->wrong_key_usage
  147. check_cxx_source_compiles("
  148. #include <gpgme.h>
  149. int main() {
  150. gpgme_decrypt_result_t res;
  151. unsigned int wku = res->wrong_key_usage;
  152. };"
  153. HAVE_GPGME_WRONG_KEY_USAGE )
  154. # check for GPGME_INCLUDE_CERTS_DEFAULT
  155. check_cxx_source_compiles("
  156. #include <gpgme.h>
  157. int main() {
  158. int i = GPGME_INCLUDE_CERTS_DEFAULT;
  159. };"
  160. HAVE_GPGME_INCLUDE_CERTS_DEFAULT )
  161. # check for gpgme_op_getauditlog
  162. check_cxx_source_compiles("
  163. #include <gpgme.h>
  164. int main() {
  165. gpgme_ctx_t ctx = 0;
  166. gpgme_data_t data = 0;
  167. unsigned int flags = 0;
  168. gpgme_error_t e = gpgme_op_getauditlog( ctx, data, flags );
  169. };"
  170. HAVE_GPGME_OP_GETAUDITLOG )
  171. # done checking for GPGME features
  172. tde_restore( CMAKE_CXX_FLAGS )
  173. tde_restore( CMAKE_REQUIRED_LIBRARIES )
  174. endif( )
  175. if( BUILD_KARM AND WITH_XSCREENSAVER )
  176. check_library_exists( Xss XScreenSaverQueryInfo "" HAVE_XSSLIB )
  177. if( HAVE_XSSLIB )
  178. pkg_search_module( XSS xscrnsaver )
  179. else( )
  180. check_library_exists( Xext XScreenSaverQueryInfo "" HAVE_XSSLIB )
  181. if( HAVE_XSSLIB )
  182. pkg_search_module( XSS xext )
  183. endif( )
  184. endif( )
  185. check_include_file( X11/extensions/scrnsaver.h HAVE_XSCREENSAVER_H )
  186. if( HAVE_XSSLIB AND HAVE_XSCREENSAVER_H )
  187. set( HAVE_LIBXSS 1 )
  188. else( )
  189. tde_message_fatal( "xscreensaver is requested, but was not found on your system" )
  190. endif( )
  191. endif( )
  192. # required stuff
  193. find_package( TQt )
  194. find_package( TDE )