Skip to content

Commit 30b3934

Browse files
committed
Use a define() to re-use version check
1 parent 4a0a33e commit 30b3934

File tree

2 files changed

+77
-29
lines changed

2 files changed

+77
-29
lines changed

configure

Lines changed: 58 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5415,22 +5415,29 @@ PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [
54155415
])
54165416
])
54175417

5418-
PKG_CHECK_MODULES([LIBZSTD], [libzstd], [have_libzstd=yes], [
5418+
define([TEST_ZSTD_VERSION],[
5419+
AC_MSG_CHECKING([if libzstd is new enough])
5420+
5421+
dnl TODO(emmatyping): check if we can set a C define for the minimum version
5422+
dnl to re-use here and in the header compile check
5423+
5424+
dnl This is checked when both a package is found and we do fallback searches
5425+
dnl If you update the minimum version here, you should update the compile
5426+
dnl check in Modules/_zstd/_zstdmodule.h
5427+
AC_RUN_IFELSE([AC_LANG_PROGRAM([@%:@include "zstd.h"], [
5428+
#if ZSTD_VERSION_NUMBER < 10405
5429+
exit(1);
5430+
#endif
5431+
])], [have_libzstd=yes], [have_libzstd=no])
5432+
])
5433+
5434+
PKG_CHECK_MODULES([LIBZSTD], [libzstd], [TEST_ZSTD_VERSION()], [
54195435
WITH_SAVE_ENV([
54205436
CPPFLAGS="$CPPFLAGS $LIBZSTD_CFLAGS"
54215437
LIBS="$LIBS $LIBZSTD_LIBS"
54225438
AC_CHECK_HEADERS([zstd.h zdict.h], [
5423-
AC_CHECK_LIB([zstd], [ZDICT_finalizeDictionary], [
5424-
AC_RUN_IFELSE([AC_LANG_PROGRAM([
5425-
#include "zstd.h"
5426-
], [
5427-
// if you update the minimum version, you should update the compile
5428-
// check in Modules/_zstd/_zstdmodule.h
5429-
#if ZSTD_VERSION_NUMBER < 10405
5430-
exit(1);
5431-
#endif
5432-
])], [have_libzstd=yes], [have_libzstd=no])
5433-
], [have_libzstd=no])
5439+
AC_CHECK_LIB([zstd], [ZDICT_finalizeDictionary],
5440+
[TEST_ZSTD_VERSION()], [have_libzstd=no])
54345441
], [have_libzstd=no])
54355442
AS_VAR_IF([have_libzstd], [yes], [
54365443
LIBZSTD_CFLAGS=${LIBZSTD_CFLAGS-""}

0 commit comments

Comments
 (0)