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.

ConfigureChecks.cmake 7.2KB

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