@@ -670,6 +670,7 @@ LIBSCTP
670670SYSTEMD_DAEMON_LIBS
671671SOCKET_LIBS
672672Z_LIB
673+ LIBZSTD
673674ERTS_USE_BUILTIN_ERRNO_ID
674675TERMCAP_LIB
675676THR_DEFS
@@ -855,6 +856,7 @@ enable_ppc_lwsync_instruction
855856with_threadnames
856857enable_use_embedded_3pp_alternatives
857858enable_builtin_errno_id
859+ enable_builtin_zstd
858860enable_builtin_zlib
859861enable_esock
860862enable_esock_use_rcvsndtimeo
@@ -1610,6 +1612,8 @@ Optional Features:
16101612 --disable-builtin-errno-id
16111613 try to find an alternative on the system to use for
16121614 errno-id
1615+ --enable-builtin-zstd force use of our own built-in zstd
1616+ --disable-builtin-zstd try to find a static libzstd on the system to use
16131617 --enable-builtin-zlib force use of our own built-in zlib
16141618 --disable-builtin-zlib try to find a zlib on the system to use
16151619 --enable-esock enable builtin socket (as a nif) support (default)
@@ -16667,12 +16671,14 @@ then :
1666716671 enableval=$enable_use_embedded_3pp_alternatives; case "$enableval" in
1666816672 no)
1666916673 enable_builtin_errno_id=yes
16674+ enable_builtin_zstd=yes
1667016675 enable_builtin_zlib=yes
1667116676 use_embedded_3pp_alts=no
1667216677 use_embedded_3pp_alts_val=0
1667316678 ;;
1667416679 *)
1667516680 enable_builtin_errno_id=no
16681+ enable_builtin_zstd=no
1667616682 enable_builtin_zlib=no
1667716683 use_embedded_3pp_alts=yes
1667816684 use_embedded_3pp_alts_val=1
@@ -16682,6 +16688,7 @@ then :
1668216688else case e in #(
1668316689 e)
1668416690 enable_builtin_errno_id=yes
16691+ enable_builtin_zstd=yes
1668516692 enable_builtin_zlib=no
1668616693 use_embedded_3pp_alts=default
1668716694 use_embedded_3pp_alts_val=-1
@@ -16731,6 +16738,82 @@ ERTS_USE_BUILTIN_ERRNO_ID=$enable_builtin_errno_id
1673116738
1673216739
1673316740
16741+ # Check whether --enable-builtin-zstd was given.
16742+ if test ${enable_builtin_zstd+y}
16743+ then :
16744+ enableval=$enable_builtin_zstd; case "$enableval" in
16745+ no) enable_builtin_zstd=no ;;
16746+ *) enable_builtin_zstd=yes ;;
16747+ esac
16748+ fi
16749+
16750+
16751+ LIBZSTD=
16752+
16753+ if test "$enable_builtin_zstd" = "no"
16754+ then :
16755+
16756+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static libzstd of version 1.5.6 or higher" >&5
16757+ printf %s "checking for static libzstd of version 1.5.6 or higher... " >&6; }
16758+ zstd_save_LIBS=$LIBS
16759+ LIBS="-l:libzstd.a $LIBS"
16760+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
16761+ /* end confdefs.h. */
16762+
16763+ #define ZSTD_STATIC_LINKING_ONLY
16764+ #include <zstd.h>
16765+ #include <zdict.h>
16766+
16767+ int
16768+ main (void)
16769+ {
16770+
16771+ #if ZSTD_VERSION_NUMBER >= 10506
16772+ (void) ZSTD_createCCtx_advanced(ZSTD_defaultCMem);
16773+ #else
16774+ #error "No libzstd of version 1.5.6 or higher found"
16775+ error
16776+ #endif
16777+
16778+ ;
16779+ return 0;
16780+ }
16781+
16782+ _ACEOF
16783+ if ac_fn_c_try_link "$LINENO"
16784+ then :
16785+
16786+ LIBZSTD="-l:libzstd.a"
16787+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
16788+ printf "%s\n" "yes" >&6; }
16789+
16790+ else case e in #(
16791+ e)
16792+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using builtin zstd instead" >&5
16793+ printf "%s\n" "no, using builtin zstd instead" >&6; }
16794+ ;;
16795+ esac
16796+ fi
16797+ rm -f core conftest.err conftest.$ac_objext conftest.beam \
16798+ conftest$ac_exeext conftest.$ac_ext
16799+
16800+ LIBS="$zstd_save_LIBS"
16801+
16802+
16803+ fi
16804+
16805+
16806+
16807+ if test "$LIBZSTD" = ""
16808+ then :
16809+
16810+
16811+ printf "%s\n" "#define ERTS_USE_BUILTIN_ZSTD 1" >>confdefs.h
16812+
16813+
16814+ fi
16815+
16816+
1673416817# Check whether --enable-builtin-zlib was given.
1673516818if test ${enable_builtin_zlib+y}
1673616819then :
0 commit comments