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.

74 lines
2.5 KiB

  1. # Copyright (c) 2009 Sun Microsystems, Inc.
  2. # Use is subject to license terms.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; version 2 of the License.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. MACRO (MYSQL_USE_BUNDLED_ZLIB)
  17. SET(ZLIB_LIBRARY zlib)
  18. SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib)
  19. SET(ZLIB_FOUND TRUE)
  20. SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib")
  21. ADD_SUBDIRECTORY(zlib)
  22. GET_TARGET_PROPERTY(src zlib SOURCES)
  23. FOREACH(file ${src})
  24. SET(ZLIB_SOURCES ${ZLIB_SOURCES} ${CMAKE_SOURCE_DIR}/zlib/${file})
  25. ENDFOREACH()
  26. ENDMACRO()
  27. # MYSQL_CHECK_ZLIB_WITH_COMPRESS
  28. #
  29. # Provides the following configure options:
  30. # WITH_ZLIB_BUNDLED
  31. # If this is set,we use bindled zlib
  32. # If this is not set,search for system zlib.
  33. # if system zlib is not found, use bundled copy
  34. # ZLIB_LIBRARIES, ZLIB_INCLUDE_DIR and ZLIB_SOURCES
  35. # are set after this macro has run
  36. MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
  37. IF(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR
  38. CMAKE_SYSTEM_NAME STREQUAL "AIX" OR
  39. CMAKE_SYSTEM_NAME STREQUAL "Windows")
  40. # Use bundled zlib on some platforms by default (system one is too
  41. # old or not existent)
  42. IF (NOT WITH_ZLIB)
  43. SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
  44. ENDIF()
  45. ENDIF()
  46. IF(WITH_ZLIB STREQUAL "bundled")
  47. MYSQL_USE_BUNDLED_ZLIB()
  48. ELSE()
  49. SET(ZLIB_FIND_QUIETLY TRUE)
  50. INCLUDE(FindZLIB)
  51. IF(ZLIB_FOUND)
  52. INCLUDE(CheckFunctionExists)
  53. SET(CMAKE_REQUIRED_LIBRARIES z)
  54. CHECK_FUNCTION_EXISTS(crc32 HAVE_CRC32)
  55. SET(CMAKE_REQUIRED_LIBRARIES)
  56. IF(HAVE_CRC32)
  57. SET(ZLIB_LIBRARY z CACHE INTERNAL "System zlib library")
  58. SET(WITH_ZLIB "system" CACHE STRING "Which zlib to use (possible values are 'bundled' or 'system')")
  59. SET(ZLIB_SOURCES "")
  60. ELSE()
  61. SET(ZLIB_FOUND FALSE CACHE INTERNAL "Zlib found but not usable")
  62. ENDIF()
  63. ENDIF()
  64. IF(NOT ZLIB_FOUND)
  65. MYSQL_USE_BUNDLED_ZLIB()
  66. ENDIF()
  67. ENDIF()
  68. SET(HAVE_COMPRESS 1)
  69. ENDMACRO()