TDE personal information management applications
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.
 
 
 
 
 
 

244 lines
7.4 KiB

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