Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable/Disable some plugins at configure time #2722

Merged
merged 14 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1110,29 +1110,47 @@ macro(set_std_filter filter)
# Upper case the filter name
string(TOUPPER "${filter}" upfilter)
string(TOLOWER "${filter}" downfilter)
if(ENABLE_FILTER_${upfilter})
# Define a test flag for filter
IF(${filter}_FOUND)
INCLUDE_DIRECTORIES(${${filter}_INCLUDE_DIRS})
SET(ENABLE_${upfilter} TRUE)
SET(HAVE_${upfilter} ON)
SET(STD_FILTERS "${STD_FILTERS} ${downfilter}")
MESSAGE(">>> Standard Filter: ${downfilter}")
IF(${filter}_FOUND)
INCLUDE_DIRECTORIES(${${filter}_INCLUDE_DIRS})
SET(ENABLE_${upfilter} TRUE)
SET(HAVE_${upfilter} ON)
SET(STD_FILTERS "${STD_FILTERS} ${downfilter}")
MESSAGE(">>> Standard Filter: ${downfilter}")
ELSE()
SET(ENABLE_${upfilter} FALSE)
SET(HAVE_${upfilter} OFF)
ENDIF()
ELSE()
SET(ENABLE_${upfilter} FALSE)
SET(HAVE_${upfilter} OFF)
ENDIF()
endmacro(set_std_filter)

# Locate some compressors
FIND_PACKAGE(Szip)
FIND_PACKAGE(Bz2)
FIND_PACKAGE(Blosc)
FIND_PACKAGE(Zstd)
OPTION(ENABLE_FILTER_SZIP "Enable use of Szip compression library if it is available. Required if ENABLE_NCZARR is true." ON)
OPTION(ENABLE_FILTER_BZ2 "Enable use of Bz2 compression library if it is available." ON)
OPTION(ENABLE_FILTER_BLOSC "Enable use of blosc compression library if it is available." ON)
OPTION(ENABLE_FILTER_ZSTD "Enable use of Zstd compression library if it is available." ON)
IF (ENABLE_FILTER_SZIP)
FIND_PACKAGE(Szip)
ELSEIF(ENABLE_NCZARR)
FIND_PACKAGE(Szip)
ENDIF()
IF (ENABLE_FILTER_BZ2)
FIND_PACKAGE(Bz2)
ENDIF()
IF (ENABLE_FILTER_BLOSC)
FIND_PACKAGE(Blosc)
ENDIF()
IF (ENABLE_FILTER_ZSTD)
FIND_PACKAGE(Zstd)
ENDIF()

# Accumulate standard filters
set(STD_FILTERS "deflate") # Always have deflate*/
set_std_filter(Szip)
SET(HAVE_SZ ${Szip_FOUND})
SET(HAVE_SZ ${Szip_FOUND})
set_std_filter(Blosc)
set_std_filter(Zstd)
IF(Bz2_FOUND)
Expand Down
125 changes: 92 additions & 33 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -711,51 +711,110 @@ AM_CONDITIONAL(ENABLE_NCZARR, [test x$enable_nczarr = xyes])
# Look for Standardized libraries
##########

# See if we have libblosc
AC_CHECK_LIB([blosc],[blosc_init],[have_blosc=yes],[have_blosc=no])
if test "x$have_blosc" = "xyes" ; then
AC_SEARCH_LIBS([blosc_init],[blosc blosc.dll cygblosc.dll], [], [])
AC_DEFINE([HAVE_BLOSC], [1], [if true, blosc library is available])
##
# blosc checks
##

# See if we want to enable blosc, and if so, search for the library.
AC_MSG_CHECKING([whether to search for and enable blosc filter support])
AC_ARG_ENABLE([filter-blosc],
[AS_HELP_STRING([--disable-filter-blosc],
[disable blosc filter support.])])
test "x$enable_filter_blosc" = xno || enable_filter_blosc=yes
AC_MSG_RESULT($enable_filter_blosc)

if test "x$enable_filter_blosc" = "xyes" ; then
# See if we have libblosc
AC_CHECK_LIB([blosc],[blosc_init],[have_blosc=yes],[have_blosc=no])
if test "x$have_blosc" = "xyes" ; then
AC_SEARCH_LIBS([blosc_init],[blosc blosc.dll cygblosc.dll], [], [])
AC_DEFINE([HAVE_BLOSC], [1], [if true, blosc library is available])
fi
else
have_blosc=no
fi
##
# End blosc checks
##

# See if we have libzstd
AC_CHECK_LIB([zstd],[ZSTD_compress],[have_zstd=yes],[have_zstd=no])
if test "x$have_zstd" = "xyes" ; then
AC_SEARCH_LIBS([ZSTD_compress],[zstd zstd.dll cygzstd.dll], [], [])
AC_DEFINE([HAVE_ZSTD], [1], [if true, zstd library is available])
##
# libzstd checks
##

# See if we want to enable libzstd, and if so, search for the library.
AC_MSG_CHECKING([whether to search for and enable libzstd filter support])
AC_ARG_ENABLE([filter-zstd],
[AS_HELP_STRING([--disable-filter-zstd],
[disable zstd filter support.])])
test "x$enable_filter_zstd" = xno || enable_filter_zstd=yes
AC_MSG_RESULT($enable_filter_zstd)

if test "x$enable_filter_zstd" = "xyes" ; then
# See if we have libzstd
AC_CHECK_LIB([zstd],[ZSTD_compress],[have_zstd=yes],[have_zstd=no])
if test "x$have_zstd" = "xyes" ; then
AC_SEARCH_LIBS([ZSTD_compress],[zstd zstd.dll cygzstd.dll], [], [])
AC_DEFINE([HAVE_ZSTD], [1], [if true, zstd library is available])

fi
AC_MSG_CHECKING([whether libzstd library is available])
AC_MSG_RESULT([${have_zstd}])

##
# Ensure that the zstd.h dev files are also available.
##
if test "x$have_zstd" = "xyes" ; then
AC_CHECK_HEADERS([zstd.h], [], [nc_zstd_h_missing=yes])
if test "x$nc_zstd_h_missing" = xyes; then
AC_MSG_WARN([zstd library detected, but zstd.h development file not found. Ensure that the zstd development files are installed in order to build zstd support.])
AC_DEFINE([HAVE_ZSTD], [0], [if true, zstd library is available])
have_zstd=no
fi
fi

else
have_zstd=no
fi
AC_MSG_CHECKING([whether libzstd library is available])
AC_MSG_RESULT([${have_zstd}])
##
# End zstd checks
##

##
# Ensure that the zstd.h dev files are also available.
# Begin bz2 checks
##
if test "x$have_zstd" = "xyes" ; then
AC_CHECK_HEADERS([zstd.h], [], [nc_zstd_h_missing=yes])
if test "x$nc_zstd_h_missing" = xyes; then
AC_MSG_WARN([zstd library detected, but zstd.h development file not found. Ensure that the zstd development files are installed in order to build zstd support.])
AC_DEFINE([HAVE_ZSTD], [0], [if true, zstd library is available])
have_zstd=no

# See if we want to enable BZ2, and if so, search for the library.
AC_MSG_CHECKING([whether to search for and enable external bz2 filter support])
AC_ARG_ENABLE([filter-bz2],
[AS_HELP_STRING([--disable-filter-bz2],
[disable external bz2 filter support. bz2 support defaults to internal implementation if this is disabled or if the external library is not found.])])
test "x$enable_filter_bz2" = xno || enable_filter_bz2=yes
AC_MSG_RESULT($enable_filter_bz2)

if test "x$enable_filter_bz2" = "xyes" ; then

AC_CHECK_LIB([bz2],[BZ2_bzCompress],[have_bz2=yes],[have_bz2=no])
if test "x$have_bz2" = "xyes" ; then
AC_SEARCH_LIBS([BZ2_bzCompress],[bz2 bz2.dll cygbz2.dll], [], [])
AC_DEFINE([HAVE_BZ2], [1], [if true, bz2 library is installed])
fi
fi
AC_MSG_CHECKING([whether libbz2 library is available])
AC_MSG_RESULT([${have_bz2}])

# See if we have libbz2
AC_CHECK_LIB([bz2],[BZ2_bzCompress],[have_bz2=yes],[have_bz2=no])
if test "x$have_bz2" = "xyes" ; then
AC_SEARCH_LIBS([BZ2_bzCompress],[bz2 bz2.dll cygbz2.dll], [], [])
AC_DEFINE([HAVE_BZ2], [1], [if true, bz2 library is installed])
fi
AC_MSG_CHECKING([whether libbz2 library is available])
AC_MSG_RESULT([${have_bz2}])

if test "x$have_bz2" = "xno" ; then
have_local_bz2=yes
AC_MSG_NOTICE([Defaulting to internal libbz2])
else
have_local_bz2=no

if test "x$have_bz2" = "xno" ; then
have_local_bz2=yes
AC_MSG_NOTICE([Defaulting to internal libbz2])
else
have_local_bz2=no
fi
fi

AM_CONDITIONAL(HAVE_LOCAL_BZ2, [test "x$have_local_bz2" = xyes])
##
# End bz2 checks
##

# Note that szip management is tricky.
# This is because we have three things to consider:
Expand Down
Loading