@@ -671,6 +671,7 @@ SYSTEMD_DAEMON_LIBS
671671SOCKET_LIBS
672672Z_LIB
673673ERTS_USE_BUILTIN_ZLIB
674+ LIBZSTD
674675ERTS_USE_BUILTIN_ERRNO_ID
675676TERMCAP_LIB
676677THR_DEFS
@@ -856,6 +857,7 @@ enable_ppc_lwsync_instruction
856857with_threadnames
857858enable_use_embedded_3pp_alternatives
858859enable_builtin_errno_id
860+ enable_builtin_zstd
859861enable_builtin_zlib
860862enable_esock
861863enable_esock_use_rcvsndtimeo
@@ -1608,6 +1610,7 @@ Optional Features:
16081610 do not use any alternatives to embedded 3pps
16091611 --enable-builtin-errno-id
16101612 force use of our own built-in errno id
1613+ --enable-builtin-zstd force use of our own built-in zstd
16111614 --enable-builtin-zlib force use of our own built-in zlib
16121615 --enable-esock enable builtin socket (as a nif) support (default)
16131616 --disable-esock disable builtin socket (as a nif) support
@@ -16643,12 +16646,14 @@ then :
1664316646 enableval=$enable_use_embedded_3pp_alternatives; case "$enableval" in
1664416647 no)
1664516648 enable_builtin_errno_id=yes
16649+ enable_builtin_zstd=yes
1664616650 enable_builtin_zlib=yes
1664716651 use_embedded_3pp_alts=no
1664816652 use_embedded_3pp_alts_val=0
1664916653 ;;
1665016654 *)
1665116655 enable_builtin_errno_id=no
16656+ enable_builtin_zstd=no
1665216657 enable_builtin_zlib=no
1665316658 use_embedded_3pp_alts=yes
1665416659 use_embedded_3pp_alts_val=1
@@ -16658,6 +16663,7 @@ then :
1665816663else case e in #(
1665916664 e)
1666016665 enable_builtin_errno_id=yes
16666+ enable_builtin_zstd=yes
1666116667 enable_builtin_zlib=no
1666216668 use_embedded_3pp_alts=default
1666316669 use_embedded_3pp_alts_val=-1
@@ -16699,6 +16705,82 @@ ERTS_USE_BUILTIN_ERRNO_ID=$enable_builtin_errno_id
1669916705
1670016706
1670116707
16708+ # Check whether --enable-builtin-zstd was given.
16709+ if test ${enable_builtin_zstd+y}
16710+ then :
16711+ enableval=$enable_builtin_zstd; case "$enableval" in
16712+ no) enable_builtin_zstd=no ;;
16713+ *) enable_builtin_zstd=yes ;;
16714+ esac
16715+ fi
16716+
16717+
16718+ LIBZSTD=
16719+
16720+ if test "$enable_builtin_zstd" = "no"
16721+ then :
16722+
16723+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libzstd of version 1.5 or higher" >&5
16724+ printf %s "checking for libzstd of version 1.5 or higher... " >&6; }
16725+ zstd_save_LIBS=$LIBS
16726+ LIBS="-lzstd $LIBS"
16727+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
16728+ /* end confdefs.h. */
16729+
16730+ #define ZSTD_STATIC_LINKING_ONLY
16731+ #include <zstd.h>
16732+ #include <zdict.h>
16733+
16734+ int
16735+ main (void)
16736+ {
16737+
16738+ #if ZSTD_VERSION_NUMBER >= 1500
16739+ (void) ZSTD_createCCtx_advanced(ZSTD_defaultCMem);
16740+ #else
16741+ #error "No libzstd of version 1.5 or higher found"
16742+ error
16743+ #endif
16744+
16745+ ;
16746+ return 0;
16747+ }
16748+
16749+ _ACEOF
16750+ if ac_fn_c_try_link "$LINENO"
16751+ then :
16752+
16753+ LIBZSTD="-lzstd"
16754+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
16755+ printf "%s\n" "yes" >&6; }
16756+
16757+ else case e in #(
16758+ e)
16759+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using builtin zstd instead" >&5
16760+ printf "%s\n" "no, using builtin zstd instead" >&6; }
16761+ ;;
16762+ esac
16763+ fi
16764+ rm -f core conftest.err conftest.$ac_objext conftest.beam \
16765+ conftest$ac_exeext conftest.$ac_ext
16766+
16767+ LIBS="$zstd_save_LIBS"
16768+
16769+
16770+ fi
16771+
16772+
16773+
16774+ if test "$LIBZSTD" = ""
16775+ then :
16776+
16777+
16778+ printf "%s\n" "#define ERTS_USE_BUILTIN_ZSTD 1" >>confdefs.h
16779+
16780+
16781+ fi
16782+
16783+
1670216784# Check whether --enable-builtin-zlib was given.
1670316785if test ${enable_builtin_zlib+y}
1670416786then :
0 commit comments