When specifying a non-system prefix with --with-zstd, the build fails because the...
authorMichael Kuhn <gcc@ikkoku.de>
Tue, 9 Jun 2020 20:05:07 +0000 (14:05 -0600)
committerJeff Law <law@redhat.com>
Tue, 9 Jun 2020 20:07:46 +0000 (14:07 -0600)
The attached patch fixes the problem and is what we use in Spack to
make GCC build with zstd support.

gcc/
* Makefile.in (ZSTD_INC): Define.
(ZSTD_LIB): Include ZSTD_LDFLAGS.
(CFLAGS-lto-compress.o): Add ZSTD_INC.
* configure.ac (ZSTD_CPPFLAGS, ZSTD_LDFLAGS): New variables for
AC_SUBST.
* configure: Rebuilt.

gcc/Makefile.in
gcc/configure
gcc/configure.ac

index be11311b60d1423606cf25f1c177e536c427504d..4f70c189b9d90361cd09bf938b3bc1d114ebac82 100644 (file)
@@ -1081,7 +1081,8 @@ GNATMAKE = @GNATMAKE@
 # Libs needed (at present) just for jcf-dump.
 LDEXP_LIB = @LDEXP_LIB@
 
-ZSTD_LIB = @ZSTD_LIB@
+ZSTD_INC = @ZSTD_CPPFLAGS@
+ZSTD_LIB = @ZSTD_LDFLAGS@ @ZSTD_LIB@
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
@@ -2286,7 +2287,7 @@ CFLAGS-version.o += -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
 version.o: $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
 
 # lto-compress.o needs $(ZLIBINC) added to the include flags.
-CFLAGS-lto-compress.o += $(ZLIBINC)
+CFLAGS-lto-compress.o += $(ZLIBINC) $(ZSTD_INC)
 
 CFLAGS-lto-streamer-in.o += -DTARGET_MACHINE=\"$(target_noncanonical)\"
 
index 629c7c7e153b9fc0d8f451702ed96893917c01bf..def9d9a48bee144f869f29e40462422000362c49 100755 (executable)
@@ -787,6 +787,8 @@ LTLIBICONV
 LIBICONV
 ZSTD_LIB
 ZSTD_INCLUDE
+ZSTD_LDFLAGS
+ZSTD_CPPFLAGS
 DL_LIB
 LDEXP_LIB
 EXTRA_GCC_LIBS
index 9e7efd13eccf955aac2822ec34c4c2d3e6fdebec..e769c9c87d4516b1bedfd1e8a1c71b1f8aa0a345 100644 (file)
@@ -1340,6 +1340,8 @@ AC_SUBST(ZSTD_INCLUDE)
 AC_SUBST(ZSTD_LIB)
 ZSTD_CPPFLAGS=
 ZSTD_LDFLAGS=
+AC_SUBST(ZSTD_CPPFLAGS)
+AC_SUBST(ZSTD_LDFLAGS)
 AC_ARG_WITH(zstd,
        [AS_HELP_STRING([--with-zstd=PATH],
                [specify prefix directory for installed zstd library.