Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6c417bb

Browse files
committed
Add support for building with ZSTD.
This commit doesn't actually add anything that uses ZSTD; that will bedone separately. It just puts the basic infrastructure into place.Jeevan Ladhe, Robert Haas, and Michael Paquier. Reviewed by JustinPryzby and Andres Freund.Discussion:http://postgr.es/m/CA+TgmoatQKGd+8SjcV+bzvw4XaoEwminHjU83yG12+NXtQzTTQ@mail.gmail.com
1 parent2e37286 commit6c417bb

File tree

9 files changed

+338
-0
lines changed

9 files changed

+338
-0
lines changed

‎configure

Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ CFLAGS_ARMV8_CRC32C
650650
CFLAGS_SSE42
651651
have_win32_dbghelp
652652
LIBOBJS
653+
ZSTD
653654
LZ4
654655
UUID_LIBS
655656
LDAP_LIBS_BE
@@ -700,6 +701,9 @@ with_gnu_ld
700701
LD
701702
LDFLAGS_SL
702703
LDFLAGS_EX
704+
ZSTD_LIBS
705+
ZSTD_CFLAGS
706+
with_zstd
703707
LZ4_LIBS
704708
LZ4_CFLAGS
705709
with_lz4
@@ -869,6 +873,7 @@ with_libxslt
869873
with_system_tzdata
870874
with_zlib
871875
with_lz4
876+
with_zstd
872877
with_gnu_ld
873878
with_ssl
874879
with_openssl
@@ -898,6 +903,8 @@ XML2_CFLAGS
898903
XML2_LIBS
899904
LZ4_CFLAGS
900905
LZ4_LIBS
906+
ZSTD_CFLAGS
907+
ZSTD_LIBS
901908
LDFLAGS_EX
902909
LDFLAGS_SL
903910
PERL
@@ -1577,6 +1584,7 @@ Optional Packages:
15771584
use system time zone data in DIR
15781585
--without-zlib do not use Zlib
15791586
--with-lz4 build with LZ4 support
1587+
--with-zstd build with ZSTD support
15801588
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
15811589
--with-ssl=LIB use LIB for SSL/TLS support (openssl)
15821590
--with-openssl obsolete spelling of --with-ssl=openssl
@@ -1606,6 +1614,8 @@ Some influential environment variables:
16061614
XML2_LIBS linker flags for XML2, overriding pkg-config
16071615
LZ4_CFLAGS C compiler flags for LZ4, overriding pkg-config
16081616
LZ4_LIBS linker flags for LZ4, overriding pkg-config
1617+
ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config
1618+
ZSTD_LIBS linker flags for ZSTD, overriding pkg-config
16091619
LDFLAGS_EX extra linker flags for linking executables only
16101620
LDFLAGS_SL extra linker flags for linking shared libraries only
16111621
PERL Perl program
@@ -9034,6 +9044,146 @@ fi
90349044
done
90359045
fi
90369046

9047+
#
9048+
# ZSTD
9049+
#
9050+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with ZSTD support" >&5
9051+
$as_echo_n "checking whether to build with ZSTD support... " >&6; }
9052+
9053+
9054+
9055+
# Check whether --with-zstd was given.
9056+
if test "${with_zstd+set}" = set; then :
9057+
withval=$with_zstd;
9058+
case $withval in
9059+
yes)
9060+
9061+
$as_echo "#define USE_ZSTD 1" >>confdefs.h
9062+
9063+
;;
9064+
no)
9065+
:
9066+
;;
9067+
*)
9068+
as_fn_error $? "no argument expected for --with-zstd option" "$LINENO" 5
9069+
;;
9070+
esac
9071+
9072+
else
9073+
with_zstd=no
9074+
9075+
fi
9076+
9077+
9078+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_zstd" >&5
9079+
$as_echo "$with_zstd" >&6; }
9080+
9081+
9082+
if test "$with_zstd" = yes; then
9083+
9084+
pkg_failed=no
9085+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd" >&5
9086+
$as_echo_n "checking for libzstd... " >&6; }
9087+
9088+
if test -n "$ZSTD_CFLAGS"; then
9089+
pkg_cv_ZSTD_CFLAGS="$ZSTD_CFLAGS"
9090+
elif test -n "$PKG_CONFIG"; then
9091+
if test -n "$PKG_CONFIG" && \
9092+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5
9093+
($PKG_CONFIG --exists --print-errors "libzstd") 2>&5
9094+
ac_status=$?
9095+
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
9096+
test $ac_status = 0; }; then
9097+
pkg_cv_ZSTD_CFLAGS=`$PKG_CONFIG --cflags "libzstd" 2>/dev/null`
9098+
test "x$?" != "x0" && pkg_failed=yes
9099+
else
9100+
pkg_failed=yes
9101+
fi
9102+
else
9103+
pkg_failed=untried
9104+
fi
9105+
if test -n "$ZSTD_LIBS"; then
9106+
pkg_cv_ZSTD_LIBS="$ZSTD_LIBS"
9107+
elif test -n "$PKG_CONFIG"; then
9108+
if test -n "$PKG_CONFIG" && \
9109+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5
9110+
($PKG_CONFIG --exists --print-errors "libzstd") 2>&5
9111+
ac_status=$?
9112+
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
9113+
test $ac_status = 0; }; then
9114+
pkg_cv_ZSTD_LIBS=`$PKG_CONFIG --libs "libzstd" 2>/dev/null`
9115+
test "x$?" != "x0" && pkg_failed=yes
9116+
else
9117+
pkg_failed=yes
9118+
fi
9119+
else
9120+
pkg_failed=untried
9121+
fi
9122+
9123+
9124+
9125+
if test $pkg_failed = yes; then
9126+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9127+
$as_echo "no" >&6; }
9128+
9129+
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
9130+
_pkg_short_errors_supported=yes
9131+
else
9132+
_pkg_short_errors_supported=no
9133+
fi
9134+
if test $_pkg_short_errors_supported = yes; then
9135+
ZSTD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libzstd" 2>&1`
9136+
else
9137+
ZSTD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libzstd" 2>&1`
9138+
fi
9139+
# Put the nasty error message in config.log where it belongs
9140+
echo "$ZSTD_PKG_ERRORS" >&5
9141+
9142+
as_fn_error $? "Package requirements (libzstd) were not met:
9143+
9144+
$ZSTD_PKG_ERRORS
9145+
9146+
Consider adjusting the PKG_CONFIG_PATH environment variable if you
9147+
installed software in a non-standard prefix.
9148+
9149+
Alternatively, you may set the environment variables ZSTD_CFLAGS
9150+
and ZSTD_LIBS to avoid the need to call pkg-config.
9151+
See the pkg-config man page for more details." "$LINENO" 5
9152+
elif test $pkg_failed = untried; then
9153+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9154+
$as_echo "no" >&6; }
9155+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
9156+
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
9157+
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
9158+
is in your PATH or set the PKG_CONFIG environment variable to the full
9159+
path to pkg-config.
9160+
9161+
Alternatively, you may set the environment variables ZSTD_CFLAGS
9162+
and ZSTD_LIBS to avoid the need to call pkg-config.
9163+
See the pkg-config man page for more details.
9164+
9165+
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
9166+
See \`config.log' for more details" "$LINENO" 5; }
9167+
else
9168+
ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS
9169+
ZSTD_LIBS=$pkg_cv_ZSTD_LIBS
9170+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9171+
$as_echo "yes" >&6; }
9172+
9173+
fi
9174+
# We only care about -I, -D, and -L switches;
9175+
# note that -lzstd will be added by AC_CHECK_LIB below.
9176+
for pgac_option in $ZSTD_CFLAGS; do
9177+
case $pgac_option in
9178+
-I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
9179+
esac
9180+
done
9181+
for pgac_option in $ZSTD_LIBS; do
9182+
case $pgac_option in
9183+
-L*) LDFLAGS="$LDFLAGS $pgac_option";;
9184+
esac
9185+
done
9186+
fi
90379187
#
90389188
# Assignments
90399189
#
@@ -13130,6 +13280,56 @@ fi
1313013280

1313113281
fi
1313213282

13283+
if test "$with_zstd" = yes ; then
13284+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZSTD_compress in -lzstd" >&5
13285+
$as_echo_n "checking for ZSTD_compress in -lzstd... " >&6; }
13286+
if ${ac_cv_lib_zstd_ZSTD_compress+:} false; then :
13287+
$as_echo_n "(cached) " >&6
13288+
else
13289+
ac_check_lib_save_LIBS=$LIBS
13290+
LIBS="-lzstd $LIBS"
13291+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13292+
/* end confdefs.h. */
13293+
13294+
/* Override any GCC internal prototype to avoid an error.
13295+
Use char because int might match the return type of a GCC
13296+
builtin and then its argument prototype would still apply. */
13297+
#ifdef __cplusplus
13298+
extern "C"
13299+
#endif
13300+
char ZSTD_compress ();
13301+
int
13302+
main ()
13303+
{
13304+
return ZSTD_compress ();
13305+
;
13306+
return 0;
13307+
}
13308+
_ACEOF
13309+
if ac_fn_c_try_link "$LINENO"; then :
13310+
ac_cv_lib_zstd_ZSTD_compress=yes
13311+
else
13312+
ac_cv_lib_zstd_ZSTD_compress=no
13313+
fi
13314+
rm -f core conftest.err conftest.$ac_objext \
13315+
conftest$ac_exeext conftest.$ac_ext
13316+
LIBS=$ac_check_lib_save_LIBS
13317+
fi
13318+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zstd_ZSTD_compress" >&5
13319+
$as_echo "$ac_cv_lib_zstd_ZSTD_compress" >&6; }
13320+
if test "x$ac_cv_lib_zstd_ZSTD_compress" = xyes; then :
13321+
cat >>confdefs.h <<_ACEOF
13322+
#define HAVE_LIBZSTD 1
13323+
_ACEOF
13324+
13325+
LIBS="-lzstd $LIBS"
13326+
13327+
else
13328+
as_fn_error $? "library 'zstd' is required for ZSTD support" "$LINENO" 5
13329+
fi
13330+
13331+
fi
13332+
1313313333
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
1313413334
# also, on AIX, we may need to have openssl in LIBS for this step.
1313513335
if test "$with_ldap" = yes ; then
@@ -13902,6 +14102,71 @@ fi
1390214102

1390314103
done
1390414104

14105+
fi
14106+
14107+
if test -z "$ZSTD"; then
14108+
for ac_prog in zstd
14109+
do
14110+
# Extract the first word of "$ac_prog", so it can be a program name with args.
14111+
set dummy $ac_prog; ac_word=$2
14112+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
14113+
$as_echo_n "checking for $ac_word... " >&6; }
14114+
if ${ac_cv_path_ZSTD+:} false; then :
14115+
$as_echo_n "(cached) " >&6
14116+
else
14117+
case $ZSTD in
14118+
[\\/]* | ?:[\\/]*)
14119+
ac_cv_path_ZSTD="$ZSTD" # Let the user override the test with a path.
14120+
;;
14121+
*)
14122+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
14123+
for as_dir in $PATH
14124+
do
14125+
IFS=$as_save_IFS
14126+
test -z "$as_dir" && as_dir=.
14127+
for ac_exec_ext in '' $ac_executable_extensions; do
14128+
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
14129+
ac_cv_path_ZSTD="$as_dir/$ac_word$ac_exec_ext"
14130+
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
14131+
break 2
14132+
fi
14133+
done
14134+
done
14135+
IFS=$as_save_IFS
14136+
14137+
;;
14138+
esac
14139+
fi
14140+
ZSTD=$ac_cv_path_ZSTD
14141+
if test -n "$ZSTD"; then
14142+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZSTD" >&5
14143+
$as_echo "$ZSTD" >&6; }
14144+
else
14145+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
14146+
$as_echo "no" >&6; }
14147+
fi
14148+
14149+
14150+
test -n "$ZSTD" && break
14151+
done
14152+
14153+
else
14154+
# Report the value of ZSTD in configure's output in all cases.
14155+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZSTD" >&5
14156+
$as_echo_n "checking for ZSTD... " >&6; }
14157+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZSTD" >&5
14158+
$as_echo "$ZSTD" >&6; }
14159+
fi
14160+
14161+
if test "$with_zstd" = yes; then
14162+
ac_fn_c_check_header_mongrel "$LINENO" "zstd.h" "ac_cv_header_zstd_h" "$ac_includes_default"
14163+
if test "x$ac_cv_header_zstd_h" = xyes; then :
14164+
14165+
else
14166+
as_fn_error $? "zstd.h header file is required for ZSTD" "$LINENO" 5
14167+
fi
14168+
14169+
1390514170
fi
1390614171

1390714172
if test "$with_gssapi" = yes ; then

‎configure.ac

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,30 @@ if test "$with_lz4" = yes; then
10561056
done
10571057
fi
10581058

1059+
#
1060+
# ZSTD
1061+
#
1062+
AC_MSG_CHECKING([whether to build with ZSTD support])
1063+
PGAC_ARG_BOOL(with, zstd, no,[build with ZSTD support],
1064+
[AC_DEFINE([USE_ZSTD],1,[Define to 1 to build with ZSTD support. (--with-zstd)])])
1065+
AC_MSG_RESULT([$with_zstd])
1066+
AC_SUBST(with_zstd)
1067+
1068+
if test "$with_zstd" = yes; then
1069+
PKG_CHECK_MODULES(ZSTD, libzstd)
1070+
# We only care about -I, -D, and -L switches;
1071+
# note that -lzstd will be added by AC_CHECK_LIB below.
1072+
for pgac_option in $ZSTD_CFLAGS; do
1073+
case $pgac_option in
1074+
-I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
1075+
esac
1076+
done
1077+
for pgac_option in $ZSTD_LIBS; do
1078+
case $pgac_option in
1079+
-L*) LDFLAGS="$LDFLAGS $pgac_option";;
1080+
esac
1081+
done
1082+
fi
10591083
#
10601084
# Assignments
10611085
#
@@ -1325,6 +1349,10 @@ if test "$with_lz4" = yes ; then
13251349
AC_CHECK_LIB(lz4,LZ4_compress_default,[],[AC_MSG_ERROR([library 'lz4' is required for LZ4 support])])
13261350
fi
13271351

1352+
if test "$with_zstd" = yes ; then
1353+
AC_CHECK_LIB(zstd,ZSTD_compress,[],[AC_MSG_ERROR([library 'zstd' is required for ZSTD support])])
1354+
fi
1355+
13281356
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
13291357
# also, on AIX, we may need to have openssl in LIBS for this step.
13301358
if test "$with_ldap" = yes ; then
@@ -1490,6 +1518,11 @@ if test "$with_lz4" = yes; then
14901518
AC_CHECK_HEADERS(lz4.h,[],[AC_MSG_ERROR([lz4.h header file is required for LZ4])])
14911519
fi
14921520

1521+
PGAC_PATH_PROGS(ZSTD, zstd)
1522+
if test "$with_zstd" = yes; then
1523+
AC_CHECK_HEADER(zstd.h,[],[AC_MSG_ERROR([zstd.h header file is required for ZSTD])])
1524+
fi
1525+
14931526
if test "$with_gssapi" = yes ; then
14941527
AC_CHECK_HEADERS(gssapi/gssapi.h,[],
14951528
[AC_CHECK_HEADERS(gssapi.h,[],[AC_MSG_ERROR([gssapi.h header file is required for GSSAPI])])])

‎doc/src/sgml/install-windows.sgml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ $ENV{MSBFLAGS}="/m";
307307
</para></listitem>
308308
</varlistentry>
309309

310+
<varlistentry>
311+
<term><productname>ZSTD</productname></term>
312+
<listitem><para>
313+
Required for supporting <productname>ZSTD</productname> compression
314+
method. Binaries and source can be downloaded from
315+
<ulink url="https://github.com/facebook/zstd/releases"></ulink>.
316+
</para></listitem>
317+
</varlistentry>
318+
310319
<varlistentry>
311320
<term><productname>OpenSSL</productname></term>
312321
<listitem><para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp