1# Copyright (C) 2015, MariaDB Corporation. All Rights Reserved. 2# 3# This program is free software; you can redistribute it and/or modify it under 4# the terms of the GNU General Public License as published by the Free Software 5# Foundation; version 2 of the License. 6# 7# This program is distributed in the hope that it will be useful, but WITHOUT 8# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 10# 11# You should have received a copy of the GNU General Public License along with 12# this program; if not, write to the Free Software Foundation, Inc., 13# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA 14 15SET(WITH_INNODB_SNAPPY AUTO CACHE STRING 16 "Build with snappy. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'") 17 18MACRO (MYSQL_CHECK_SNAPPY) 19 IF (WITH_INNODB_SNAPPY STREQUAL "ON" OR WITH_INNODB_SNAPPY STREQUAL "AUTO") 20 find_path(SNAPPY_INCLUDE_DIR NAMES snappy-c.h) 21 find_library(SNAPPY_LIBRARY NAMES snappy) 22 get_filename_component(SNAPPY_LIBDIR ${SNAPPY_LIBRARY} DIRECTORY) 23 IF (SNAPPY_INCLUDE_DIR) 24 SET(HAVE_SNAPPY_H 1) 25 ENDIF() 26 CHECK_LIBRARY_EXISTS(snappy snappy_uncompress ${SNAPPY_LIBDIR} HAVE_SNAPPY_SHARED_LIB) 27#MESSAGE(STATUS "HAVE_SNAPPY_H=${HAVE_SNAPPY_H} HAVE_SNAPPY_SHARED_LIB=${HAVE_SNAPPY_SHARED_LIB} SNAPPY_LIBDIR=${SNAPPY_LIBDIR} ") 28 29 IF(HAVE_SNAPPY_SHARED_LIB AND HAVE_SNAPPY_H) 30 SET(HAVE_INNODB_SNAPPY TRUE) 31 ADD_DEFINITIONS(-DHAVE_SNAPPY=1) 32 LINK_LIBRARIES(${SNAPPY_LIBRARY}) 33 ELSE() 34 IF (WITH_INNODB_SNAPPY STREQUAL "ON") 35 MESSAGE(FATAL_ERROR "Required snappy library is not found") 36 ENDIF() 37 ENDIF() 38 ENDIF() 39 ADD_FEATURE_INFO(INNODB_SNAPPY HAVE_INNODB_SNAPPY "Snappy compression in the InnoDB storage engine") 40ENDMACRO() 41