1# Copyright (C) 2014, SkySQL Ab. 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_LZO AUTO CACHE STRING
16  "Build with lzo. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
17
18MACRO (MYSQL_CHECK_LZO)
19  IF (WITH_INNODB_LZO STREQUAL "ON" OR WITH_INNODB_LZO STREQUAL "AUTO")
20    CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H)
21    CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_SHARED_LIB)
22
23    IF(HAVE_LZO_SHARED_LIB AND HAVE_LZO_H)
24      SET(HAVE_INNODB_LZO TRUE)
25      ADD_DEFINITIONS(-DHAVE_LZO=1)
26      LINK_LIBRARIES(lzo2)
27    ELSE()
28      IF (WITH_INNODB_LZO STREQUAL "ON")
29        MESSAGE(FATAL_ERROR "Required lzo library is not found")
30      ENDIF()
31    ENDIF()
32  ENDIF()
33  ADD_FEATURE_INFO(INNODB_LZO HAVE_INNODB_LZO "LZO compression in the InnoDB storage engine")
34ENDMACRO()
35