Skip to content

Commit ccddbbc

Browse files
Jim Wilsonkito-cheng
Jim Wilson
authored andcommitted
Fix build failure with zstd versio9n 1.2.0 or older.
Extends the configure check for zstd.h to also verify the zstd version, since gcc requires features that only exist in 1.3.0 and newer. Without this patch we get a build error for lto-compress.c when using an old zstd version. Backported from master: 2020-09-29 Jim Wilson <jimw@sifive.com> gcc/ PR bootstrap/97183 * configure.ac (gcc_cv_header_zstd_h): Check ZSTD_VERISON_NUMBER. * configure: Regenerated.
1 parent 463e7cf commit ccddbbc

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

gcc/configure

+8-3
Original file line numberDiff line numberDiff line change
@@ -10024,9 +10024,14 @@ $as_echo_n "checking for zstd.h... " >&6; }
1002410024
if ${gcc_cv_header_zstd_h+:} false; then :
1002510025
$as_echo_n "(cached) " >&6
1002610026
else
10027-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10027+
# We require version 1.3.0 or later. This is the first version that has
10028+
# ZSTD_getFrameContentSize.
10029+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1002810030
/* end confdefs.h. */
1002910031
#include <zstd.h>
10032+
#if ZSTD_VERSION_NUMBER < 10300
10033+
#error "need zstd 1.3.0 or better"
10034+
#endif
1003010035
int
1003110036
main ()
1003210037
{
@@ -19015,7 +19020,7 @@ else
1901519020
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1901619021
lt_status=$lt_dlunknown
1901719022
cat > conftest.$ac_ext <<_LT_EOF
19018-
#line 19018 "configure"
19023+
#line 19023 "configure"
1901919024
#include "confdefs.h"
1902019025

1902119026
#if HAVE_DLFCN_H
@@ -19121,7 +19126,7 @@ else
1912119126
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1912219127
lt_status=$lt_dlunknown
1912319128
cat > conftest.$ac_ext <<_LT_EOF
19124-
#line 19124 "configure"
19129+
#line 19129 "configure"
1912519130
#include "confdefs.h"
1912619131

1912719132
#if HAVE_DLFCN_H

gcc/configure.ac

+6-1
Original file line numberDiff line numberDiff line change
@@ -1382,8 +1382,13 @@ LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS"
13821382

13831383
AC_MSG_CHECKING(for zstd.h)
13841384
AC_CACHE_VAL(gcc_cv_header_zstd_h,
1385+
# We require version 1.3.0 or later. This is the first version that has
1386+
# ZSTD_getFrameContentSize.
13851387
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1386-
[[#include <zstd.h>]])],
1388+
[[#include <zstd.h>
1389+
#if ZSTD_VERSION_NUMBER < 10300
1390+
#error "need zstd 1.3.0 or better"
1391+
#endif]])],
13871392
[gcc_cv_header_zstd_h=yes],
13881393
[gcc_cv_header_zstd_h=no])])
13891394
AC_MSG_RESULT($gcc_cv_header_zstd_h)

0 commit comments

Comments
 (0)