Configure.cmake 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. # Licensed under the Apache License, Version 2.0 (the "License");
  2. # you may not use this file except in compliance with the License.
  3. # You may obtain a copy of the License at
  4. # http://www.apache.org/licenses/LICENSE-2.0
  5. # Unless required by applicable law or agreed to in writing, software
  6. # distributed under the License is distributed on an "AS IS" BASIS,
  7. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  8. # See the License for the specific language governing permissions and
  9. # limitations under the License.
  10. ################################################################################
  11. #
  12. # configure
  13. #
  14. ################################################################################
  15. ########################################
  16. # FUNCTION check_includes
  17. ########################################
  18. function(check_includes files)
  19. foreach(F ${${files}})
  20. set(name ${F})
  21. string(REPLACE "-" "_" name ${name})
  22. string(REPLACE "." "_" name ${name})
  23. string(REPLACE "/" "_" name ${name})
  24. string(TOUPPER ${name} name)
  25. check_include_files(${F} HAVE_${name})
  26. file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if you have the <${F}> header file. */\n")
  27. file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
  28. file(APPEND ${AUTOCONFIG_SRC} "\n")
  29. endforeach()
  30. endfunction(check_includes)
  31. ########################################
  32. # FUNCTION check_functions
  33. ########################################
  34. function(check_functions functions)
  35. foreach(F ${${functions}})
  36. set(name ${F})
  37. string(TOUPPER ${name} name)
  38. check_function_exists(${F} HAVE_${name})
  39. file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if you have the `${F}' function. */\n")
  40. file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
  41. file(APPEND ${AUTOCONFIG_SRC} "\n")
  42. endforeach()
  43. endfunction(check_functions)
  44. ########################################
  45. # FUNCTION check_types
  46. ########################################
  47. function(check_types types)
  48. foreach(T ${${types}})
  49. set(name ${T})
  50. string(REPLACE " " "_" name ${name})
  51. string(REPLACE "-" "_" name ${name})
  52. string(REPLACE "." "_" name ${name})
  53. string(REPLACE "/" "_" name ${name})
  54. string(TOUPPER ${name} name)
  55. check_type_size(${T} HAVE_${name})
  56. file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if the system has the type `${T}'. */\n")
  57. file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
  58. file(APPEND ${AUTOCONFIG_SRC} "\n")
  59. endforeach()
  60. endfunction(check_types)
  61. ########################################
  62. file(WRITE ${AUTOCONFIG_SRC})
  63. include(CheckCSourceCompiles)
  64. include(CheckCSourceRuns)
  65. include(CheckCXXSourceCompiles)
  66. include(CheckCXXSourceRuns)
  67. include(CheckFunctionExists)
  68. include(CheckIncludeFiles)
  69. include(CheckLibraryExists)
  70. include(CheckPrototypeDefinition)
  71. include(CheckStructHasMember)
  72. include(CheckSymbolExists)
  73. include(CheckTypeSize)
  74. include(TestBigEndian)
  75. set(include_files_list
  76. dlfcn.h
  77. inttypes.h
  78. limits.h
  79. malloc.h
  80. memory.h
  81. stdbool.h
  82. stdint.h
  83. stdlib.h
  84. string.h
  85. sys/ipc.h
  86. sys/shm.h
  87. sys/stat.h
  88. sys/types.h
  89. sys/wait.h
  90. unistd.h
  91. cairo/cairo-version.h
  92. CL/cl.h
  93. OpenCL/cl.h
  94. pango-1.0/pango/pango-features.h
  95. tiffio.h
  96. unicode/uchar.h
  97. )
  98. check_includes(include_files_list)
  99. set(types_list
  100. "long long int"
  101. off_t
  102. mbstate_t
  103. wchar_t
  104. _Bool
  105. )
  106. check_types(types_list)
  107. file(APPEND ${AUTOCONFIG_SRC} "
  108. /* Version number */
  109. #cmakedefine PACKAGE_VERSION \"${PACKAGE_VERSION}\"
  110. #cmakedefine GRAPHICS_DISABLED ${GRAPHICS_DISABLED}
  111. #cmakedefine DISABLED_LEGACY_ENGINE ${DISABLED_LEGACY_ENGINE}
  112. #cmakedefine HAVE_LIBARCHIVE ${HAVE_LIBARCHIVE}
  113. ")
  114. if(TESSDATA_PREFIX)
  115. add_definitions(-DTESSDATA_PREFIX=${TESSDATA_PREFIX})
  116. file(APPEND ${AUTOCONFIG_SRC} "
  117. #cmakedefine TESSDATA_PREFIX ${TESSDATA_PREFIX}
  118. ")
  119. endif()
  120. test_big_endian(WORDS_BIGENDIAN)
  121. file(APPEND ${AUTOCONFIG_SRC} "
  122. /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
  123. significant byte first (like Motorola and SPARC, unlike Intel). */
  124. #cmakedefine WORDS_BIGENDIAN 1
  125. ")
  126. ########################################
  127. ################################################################################
Tip!

Press p or to see the previous file or, n or to see the next file