diff options
author | Martin Liska <mliska@suse.cz> | 2019-07-03 10:36:54 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-07-03 08:36:54 +0000 |
commit | 87741e51b53511bed2bd687dc48fe8578ae81d6c (patch) | |
tree | e230e0bcb2b3cceb4f9d73ecbd46d47f7fa7ffd0 /gcc/configure.ac | |
parent | 88614dfa2bb5a40566bef00a85b13c4b167dc3c5 (diff) |
Add zstd support for LTO bytecode compression.
2019-07-03 Martin Liska <mliska@suse.cz>
* Makefile.in: Define ZSTD_LIB.
* common.opt: Adjust compression level
to support also zstd levels.
* config.in: Regenerate.
* configure: Likewise.
* configure.ac: Add --with-zstd and --with-zstd-include options
and detect ZSTD.
* doc/install.texi: Mention zstd dependency.
* gcc.c: Print supported LTO compression algorithms.
* lto-compress.c (lto_normalized_zstd_level): Likewise.
(lto_compression_zstd): Likewise.
(lto_uncompression_zstd): Likewise.
(lto_end_compression): Dispatch in between zlib and zstd.
(lto_compression_zlib): Mark with ATTRIBUTE_UNUSED.
(lto_uncompression_zlib): Make it static.
* lto-compress.h (lto_end_uncompression): Fix GNU coding style.
* lto-section-in.c (lto_get_section_data): Pass info
about used compression.
* lto-streamer-out.c: By default use zstd when possible.
* timevar.def (TV_IPA_LTO_DECOMPRESS): Rename to decompression
(TV_IPA_LTO_COMPRESS): Likewise for compression.
From-SVN: r272996
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r-- | gcc/configure.ac | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac index 066a6f4c958..137d5b469c3 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1258,6 +1258,72 @@ if test $gcc_cv_header_inttypes_h = yes; then [Define if you have a working <inttypes.h> header file.]) fi +# Look for the ZSTD package. +ZSTD_INCLUDE= +ZSTD_LIB= +AC_SUBST(ZSTD_INCLUDE) +AC_SUBST(ZSTD_LIB) +ZSTD_CPPFLAGS= +ZSTD_LDFLAGS= +AC_ARG_WITH(zstd, + [AS_HELP_STRING([--with-zstd=PATH], + [specify prefix directory for installed zstd library. + Equivalent to --with-zstd-include=PATH/include + plus --with-zstd-lib=PATH/lib])]) +AC_ARG_WITH(zstd-include, + [AS_HELP_STRING([--with-zstd-include=PATH], + [specify directory for installed zstd include files])]) +AC_ARG_WITH(zstd-lib, + [AS_HELP_STRING([--with-zstd-lib=PATH], + [specify directory for the installed zstd library])]) +case "x$with_zstd" in + x) ;; + xno) + ZSTD_INCLUDE=no + ZSTD_LIB=no + ;; + *) ZSTD_INCLUDE=$with_zstd/include + ZSTD_LIB=$with_zstd/lib + ;; +esac +if test "x$with_zstd_include" != x; then + ZSTD_INCLUDE=$with_zstd_include +fi +if test "x$with_zstd_lib" != x; then + ZSTD_LIB=$with_zstd_lib +fi +if test "x$ZSTD_INCLUDE" != x \ + && test "x$ZSTD_INCLUDE" != xno; then + ZSTD_CPPFLAGS=-I$ZSTD_INCLUDE +fi +if test "x$ZSTD_LIB" != x \ + && test "x$ZSTD_LIB" != xno; then + ZSTD_LDFLAGS=-L$ZSTD_LIB +fi + +CXXFLAGS="$CXXFLAGS $ZSTD_CPPFLAGS" +LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS" + +AC_MSG_CHECKING(for zstd.h) +AC_CACHE_VAL(gcc_cv_header_zstd_h, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[#include <zstd.h>]])], + [gcc_cv_header_zstd_h=yes], + [gcc_cv_header_zstd_h=no])]) +AC_MSG_RESULT($gcc_cv_header_zstd_h) +if test $gcc_cv_header_zstd_h = yes; then + AC_DEFINE(HAVE_ZSTD_H, 1, + [Define if you have a working <zstd.h> header file.]) +fi + +# LTO can use zstd compression algorithm +save_LIBS="$LIBS" +LIBS= +AC_SEARCH_LIBS(ZSTD_compress, zstd) +ZSTD_LIB="$LIBS" +LIBS="$save_LIBS" +AC_SUBST(ZSTD_LIB) + dnl Disabled until we have a complete test for buggy enum bitfields. dnl gcc_AC_C_ENUM_BF_UNSIGNED |