* [PATCH] configure: Support --with-zstd=PATH
@ 2026-09-27 11:48 Torbjörn SVENSSON
0 siblings, 0 replies; only message in thread
From: Torbjörn SVENSSON @ 2026-09-27 11:48 UTC (permalink / raw)
To: binutils, gdb-patches; +Cc: Torbjörn SVENSSON
Hi,
I noticed that the configure scripts in this repository does not use the path
given to the --with-zstd option, while for example GCC does. This patch adds
the missing logic in config/zstd.m4 and regenerat the configure files with that
change.
Also worth noting is that I see blocks like below (manually excluded in this
patch) when I run autoconf2.69:
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
Is there a reason why the checked in configure files does not align with the
tool mentioned in the checked in files?
Ok for master?
Kind regards,
Torbjörn
--
Allow --with-zstd to specify an installation prefix. Use the headers
and static library under that prefix, and reject it if it does not
provide zstd 1.4.0 or newer.
Regenerate the affected configure scripts.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
bfd/configure | 90 +++++++++++++++++++++++++++++++++++++++++-----
binutils/configure | 90 +++++++++++++++++++++++++++++++++++++++++-----
config/zstd.m4 | 63 +++++++++++++++++++++++++++-----
gas/configure | 90 +++++++++++++++++++++++++++++++++++++++++-----
gdb/configure | 90 +++++++++++++++++++++++++++++++++++++++++-----
gold/configure | 90 +++++++++++++++++++++++++++++++++++++++++-----
ld/configure | 90 +++++++++++++++++++++++++++++++++++++++++-----
7 files changed, 540 insertions(+), 63 deletions(-)
diff --git a/bfd/configure b/bfd/configure
index a4326160c57..d44e8cfb527 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -1540,8 +1540,8 @@ Optional Packages:
--without-libintl-prefix don't search for libintl in includedir and libdir
--with-libintl-type=TYPE type of library to search for (auto/static/shared)
--with-system-zlib use installed libz
- --with-zstd support zstd compressed debug sections
- (default=auto)
+ --with-zstd[=PATH] support zstd compressed debug sections, optionally
+ using zstd installed under PATH (default=auto)
Some influential environment variables:
CC C compiler command
@@ -15423,7 +15423,11 @@ else
fi
-if test "$with_zstd" != no; then :
+case $with_zstd in #(
+ no) :
+ ;; #(
+ yes|auto) :
+
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd >= 1.4.0" >&5
@@ -15508,17 +15512,21 @@ fi
echo "$ZSTD_PKG_ERRORS" >&5
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
else
ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS
@@ -15531,8 +15539,72 @@ $as_echo "#define HAVE_ZSTD 1" >>confdefs.h
fi
+ ;; #(
+ *) :
+
+ ZSTD_CFLAGS="-I$with_zstd/include"
+ ZSTD_LIBS="$with_zstd/lib/libzstd.a"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zstd >= 1.4.0 in $with_zstd" >&5
+$as_echo_n "checking for zstd >= 1.4.0 in $with_zstd... " >&6; }
+
+ zstd_save_CPPFLAGS=$CPPFLAGS
+ zstd_save_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ZSTD_CFLAGS"
+ LIBS="$ZSTD_LIBS $LIBS"
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <zstd.h>
+#if ZSTD_VERSION_NUMBER < 10400
+# error zstd 1.4.0 or later is required
+#endif
+
+int
+main ()
+{
+
+ (void) ZSTD_compress(0, 0, 0, 0, 1);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ have_zstd=yes
+else
+ have_zstd=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ CPPFLAGS=$zstd_save_CPPFLAGS
+ LIBS=$zstd_save_LIBS
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_zstd" >&5
+$as_echo "$have_zstd" >&6; }
+
+ if test "$have_zstd" = yes; then :
+
+ pkg_cv_ZSTD_CFLAGS=$ZSTD_CFLAGS
+ pkg_cv_ZSTD_LIBS=$ZSTD_LIBS
+
+$as_echo "#define HAVE_ZSTD 1" >>confdefs.h
+
+
+else
+
+ as_fn_error $? "zstd >= 1.4.0 was not found under $with_zstd" "$LINENO" 5
fi
+ ;; #(
+ *) :
+ ;;
+esac
+
+
+
save_CFLAGS="$CFLAGS"
diff --git a/binutils/configure b/binutils/configure
index ea19d09749f..4bae6ae8549 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -1540,8 +1540,8 @@ Optional Packages:
--without-libintl-prefix don't search for libintl in includedir and libdir
--with-libintl-type=TYPE type of library to search for (auto/static/shared)
--with-system-zlib use installed libz
- --with-zstd support zstd compressed debug sections
- (default=auto)
+ --with-zstd[=PATH] support zstd compressed debug sections, optionally
+ using zstd installed under PATH (default=auto)
--with-msgpack Enable msgpack support (auto/yes/no)
Some influential environment variables:
@@ -15873,7 +15873,11 @@ else
fi
-if test "$with_zstd" != no; then :
+case $with_zstd in #(
+ no) :
+ ;; #(
+ yes|auto) :
+
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd >= 1.4.0" >&5
@@ -15958,17 +15962,21 @@ fi
echo "$ZSTD_PKG_ERRORS" >&5
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
else
ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS
@@ -15981,8 +15989,72 @@ $as_echo "#define HAVE_ZSTD 1" >>confdefs.h
fi
+ ;; #(
+ *) :
+
+ ZSTD_CFLAGS="-I$with_zstd/include"
+ ZSTD_LIBS="$with_zstd/lib/libzstd.a"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zstd >= 1.4.0 in $with_zstd" >&5
+$as_echo_n "checking for zstd >= 1.4.0 in $with_zstd... " >&6; }
+
+ zstd_save_CPPFLAGS=$CPPFLAGS
+ zstd_save_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ZSTD_CFLAGS"
+ LIBS="$ZSTD_LIBS $LIBS"
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <zstd.h>
+#if ZSTD_VERSION_NUMBER < 10400
+# error zstd 1.4.0 or later is required
+#endif
+
+int
+main ()
+{
+
+ (void) ZSTD_compress(0, 0, 0, 0, 1);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ have_zstd=yes
+else
+ have_zstd=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ CPPFLAGS=$zstd_save_CPPFLAGS
+ LIBS=$zstd_save_LIBS
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_zstd" >&5
+$as_echo "$have_zstd" >&6; }
+
+ if test "$have_zstd" = yes; then :
+
+ pkg_cv_ZSTD_CFLAGS=$ZSTD_CFLAGS
+ pkg_cv_ZSTD_LIBS=$ZSTD_LIBS
+
+$as_echo "#define HAVE_ZSTD 1" >>confdefs.h
+
+
+else
+
+ as_fn_error $? "zstd >= 1.4.0 was not found under $with_zstd" "$LINENO" 5
fi
+ ;; #(
+ *) :
+ ;;
+esac
+
+
+
diff --git a/config/zstd.m4 b/config/zstd.m4
index eb34c0f36d7..f3c25984ba9 100644
--- a/config/zstd.m4
+++ b/config/zstd.m4
@@ -8,16 +8,61 @@ dnl the same distribution terms as the rest of that program.
dnl Enable features using the zstd library.
AC_DEFUN([AC_ZSTD], [
AC_ARG_WITH(zstd,
- [AS_HELP_STRING([--with-zstd], [support zstd compressed debug sections (default=auto)])],
+ [AS_HELP_STRING([--with-zstd@<:@=PATH@:>@],
+ [support zstd compressed debug sections, optionally using zstd installed under PATH (default=auto)])],
[], [with_zstd=auto])
-AS_IF([test "$with_zstd" != no],
- [PKG_CHECK_MODULES(ZSTD, [libzstd >= 1.4.0], [
- AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.])
- ], [
- if test "$with_zstd" = yes; then
- AC_MSG_ERROR([--with-zstd was given, but pkgconfig/libzstd.pc is not found])
- fi
- ])
+AS_CASE([$with_zstd],
+ [no], [],
+ [yes|auto], [
+ PKG_CHECK_MODULES([ZSTD], [libzstd >= 1.4.0], [
+ AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.])
+ ], [
+ AS_IF([test "$with_zstd" = yes], [
+ AC_MSG_ERROR(
+ [--with-zstd was given, but pkgconfig/libzstd.pc is not found])
+ ])
+ ])
+ ],
+ [*], [
+ ZSTD_CFLAGS="-I$with_zstd/include"
+ ZSTD_LIBS="$with_zstd/lib/libzstd.a"
+
+ AC_MSG_CHECKING([for zstd >= 1.4.0 in $with_zstd])
+
+ zstd_save_CPPFLAGS=$CPPFLAGS
+ zstd_save_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ZSTD_CFLAGS"
+ LIBS="$ZSTD_LIBS $LIBS"
+
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <zstd.h>
+#if ZSTD_VERSION_NUMBER < 10400
+# error zstd 1.4.0 or later is required
+#endif
+ ]],
+ [[
+ (void) ZSTD_compress(0, 0, 0, 0, 1);
+ ]])],
+ [have_zstd=yes],
+ [have_zstd=no])
+
+ CPPFLAGS=$zstd_save_CPPFLAGS
+ LIBS=$zstd_save_LIBS
+
+ AC_MSG_RESULT([$have_zstd])
+
+ AS_IF([test "$have_zstd" = yes], [
+ pkg_cv_ZSTD_CFLAGS=$ZSTD_CFLAGS
+ pkg_cv_ZSTD_LIBS=$ZSTD_LIBS
+ AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.])
+ ], [
+ AC_MSG_ERROR([zstd >= 1.4.0 was not found under $with_zstd])
+ ])
])
+
+AC_SUBST([ZSTD_CFLAGS])
+AC_SUBST([ZSTD_LIBS])
])
diff --git a/gas/configure b/gas/configure
index 8afaf2729ed..59272c76117 100755
--- a/gas/configure
+++ b/gas/configure
@@ -1531,8 +1531,8 @@ Optional Packages:
--without-libintl-prefix don't search for libintl in includedir and libdir
--with-libintl-type=TYPE type of library to search for (auto/static/shared)
--with-system-zlib use installed libz
- --with-zstd support zstd compressed debug sections
- (default=auto)
+ --with-zstd[=PATH] support zstd compressed debug sections, optionally
+ using zstd installed under PATH (default=auto)
Some influential environment variables:
CC C compiler command
@@ -16150,7 +16150,11 @@ else
fi
-if test "$with_zstd" != no; then :
+case $with_zstd in #(
+ no) :
+ ;; #(
+ yes|auto) :
+
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd >= 1.4.0" >&5
@@ -16235,17 +16239,21 @@ fi
echo "$ZSTD_PKG_ERRORS" >&5
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
else
ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS
@@ -16258,8 +16266,72 @@ $as_echo "#define HAVE_ZSTD 1" >>confdefs.h
fi
+ ;; #(
+ *) :
+
+ ZSTD_CFLAGS="-I$with_zstd/include"
+ ZSTD_LIBS="$with_zstd/lib/libzstd.a"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zstd >= 1.4.0 in $with_zstd" >&5
+$as_echo_n "checking for zstd >= 1.4.0 in $with_zstd... " >&6; }
+
+ zstd_save_CPPFLAGS=$CPPFLAGS
+ zstd_save_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ZSTD_CFLAGS"
+ LIBS="$ZSTD_LIBS $LIBS"
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <zstd.h>
+#if ZSTD_VERSION_NUMBER < 10400
+# error zstd 1.4.0 or later is required
+#endif
+
+int
+main ()
+{
+
+ (void) ZSTD_compress(0, 0, 0, 0, 1);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ have_zstd=yes
+else
+ have_zstd=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ CPPFLAGS=$zstd_save_CPPFLAGS
+ LIBS=$zstd_save_LIBS
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_zstd" >&5
+$as_echo "$have_zstd" >&6; }
+
+ if test "$have_zstd" = yes; then :
+
+ pkg_cv_ZSTD_CFLAGS=$ZSTD_CFLAGS
+ pkg_cv_ZSTD_LIBS=$ZSTD_LIBS
+
+$as_echo "#define HAVE_ZSTD 1" >>confdefs.h
+
+
+else
+
+ as_fn_error $? "zstd >= 1.4.0 was not found under $with_zstd" "$LINENO" 5
fi
+ ;; #(
+ *) :
+ ;;
+esac
+
+
+
# Support for VMS timestamps via cross compile
diff --git a/gdb/configure b/gdb/configure
index 810e9ed7a37..1f1aa5f606a 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -1721,8 +1721,8 @@ Optional Packages:
--with-pkgversion=PKG Use PKG in the version string in place of "GDB"
--with-bugurl=URL Direct users to URL to report a bug
--with-system-zlib use installed libz
- --with-zstd support zstd compressed debug sections
- (default=auto)
+ --with-zstd[=PATH] support zstd compressed debug sections, optionally
+ using zstd installed under PATH (default=auto)
--with-iconv-bin=PATH specify where to find the iconv program
--with-system-readline use installed readline library
--with-jit-reader-dir=PATH
@@ -26723,7 +26723,11 @@ else
fi
-if test "$with_zstd" != no; then :
+case $with_zstd in #(
+ no) :
+ ;; #(
+ yes|auto) :
+
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd >= 1.4.0" >&5
@@ -26808,17 +26812,21 @@ fi
echo "$ZSTD_PKG_ERRORS" >&5
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
else
ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS
@@ -26831,8 +26839,72 @@ $as_echo "#define HAVE_ZSTD 1" >>confdefs.h
fi
+ ;; #(
+ *) :
+
+ ZSTD_CFLAGS="-I$with_zstd/include"
+ ZSTD_LIBS="$with_zstd/lib/libzstd.a"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zstd >= 1.4.0 in $with_zstd" >&5
+$as_echo_n "checking for zstd >= 1.4.0 in $with_zstd... " >&6; }
+
+ zstd_save_CPPFLAGS=$CPPFLAGS
+ zstd_save_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ZSTD_CFLAGS"
+ LIBS="$ZSTD_LIBS $LIBS"
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <zstd.h>
+#if ZSTD_VERSION_NUMBER < 10400
+# error zstd 1.4.0 or later is required
+#endif
+
+int
+main ()
+{
+
+ (void) ZSTD_compress(0, 0, 0, 0, 1);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ have_zstd=yes
+else
+ have_zstd=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ CPPFLAGS=$zstd_save_CPPFLAGS
+ LIBS=$zstd_save_LIBS
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_zstd" >&5
+$as_echo "$have_zstd" >&6; }
+
+ if test "$have_zstd" = yes; then :
+
+ pkg_cv_ZSTD_CFLAGS=$ZSTD_CFLAGS
+ pkg_cv_ZSTD_LIBS=$ZSTD_LIBS
+
+$as_echo "#define HAVE_ZSTD 1" >>confdefs.h
+
+
+else
+
+ as_fn_error $? "zstd >= 1.4.0 was not found under $with_zstd" "$LINENO" 5
fi
+ ;; #(
+ *) :
+ ;;
+esac
+
+
+
diff --git a/gold/configure b/gold/configure
index a81a04f0531..ec755535dff 100755
--- a/gold/configure
+++ b/gold/configure
@@ -1555,8 +1555,8 @@ Optional Packages:
--with-gold-ldflags=FLAGS additional link flags for gold
--with-gold-ldadd=LIBS additional libraries for gold
--with-system-zlib use installed libz
- --with-zstd support zstd compressed debug sections
- (default=auto)
+ --with-zstd[=PATH] support zstd compressed debug sections, optionally
+ using zstd installed under PATH (default=auto)
Some influential environment variables:
CC C compiler command
@@ -9997,7 +9997,11 @@ else
fi
-if test "$with_zstd" != no; then :
+case $with_zstd in #(
+ no) :
+ ;; #(
+ yes|auto) :
+
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd >= 1.4.0" >&5
@@ -10082,17 +10086,21 @@ fi
echo "$ZSTD_PKG_ERRORS" >&5
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
else
ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS
@@ -10105,8 +10113,72 @@ $as_echo "#define HAVE_ZSTD 1" >>confdefs.h
fi
+ ;; #(
+ *) :
+
+ ZSTD_CFLAGS="-I$with_zstd/include"
+ ZSTD_LIBS="$with_zstd/lib/libzstd.a"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zstd >= 1.4.0 in $with_zstd" >&5
+$as_echo_n "checking for zstd >= 1.4.0 in $with_zstd... " >&6; }
+
+ zstd_save_CPPFLAGS=$CPPFLAGS
+ zstd_save_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ZSTD_CFLAGS"
+ LIBS="$ZSTD_LIBS $LIBS"
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <zstd.h>
+#if ZSTD_VERSION_NUMBER < 10400
+# error zstd 1.4.0 or later is required
+#endif
+
+int
+main ()
+{
+
+ (void) ZSTD_compress(0, 0, 0, 0, 1);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ have_zstd=yes
+else
+ have_zstd=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ CPPFLAGS=$zstd_save_CPPFLAGS
+ LIBS=$zstd_save_LIBS
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_zstd" >&5
+$as_echo "$have_zstd" >&6; }
+
+ if test "$have_zstd" = yes; then :
+
+ pkg_cv_ZSTD_CFLAGS=$ZSTD_CFLAGS
+ pkg_cv_ZSTD_LIBS=$ZSTD_LIBS
+
+$as_echo "#define HAVE_ZSTD 1" >>confdefs.h
+
+
+else
+
+ as_fn_error $? "zstd >= 1.4.0 was not found under $with_zstd" "$LINENO" 5
fi
+ ;; #(
+ *) :
+ ;;
+esac
+
+
+
if test "$pkg_cv_ZSTD_LIBS" != ""; then
HAVE_ZSTD_TRUE=
diff --git a/ld/configure b/ld/configure
index 4d755384c41..c5f7356b275 100755
--- a/ld/configure
+++ b/ld/configure
@@ -1598,8 +1598,8 @@ Optional Packages:
--with-xxhash use inlined libxxhash for hashing (faster)
(auto/yes/no)
--with-system-zlib use installed libz
- --with-zstd support zstd compressed debug sections
- (default=auto)
+ --with-zstd[=PATH] support zstd compressed debug sections, optionally
+ using zstd installed under PATH (default=auto)
Some influential environment variables:
CC C compiler command
@@ -19088,7 +19088,11 @@ else
fi
-if test "$with_zstd" != no; then :
+case $with_zstd in #(
+ no) :
+ ;; #(
+ yes|auto) :
+
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd >= 1.4.0" >&5
@@ -19173,17 +19177,21 @@ fi
echo "$ZSTD_PKG_ERRORS" >&5
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- if test "$with_zstd" = yes; then
- as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
- fi
+ if test "$with_zstd" = yes; then :
+
+ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+
+fi
else
ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS
@@ -19196,8 +19204,72 @@ $as_echo "#define HAVE_ZSTD 1" >>confdefs.h
fi
+ ;; #(
+ *) :
+
+ ZSTD_CFLAGS="-I$with_zstd/include"
+ ZSTD_LIBS="$with_zstd/lib/libzstd.a"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zstd >= 1.4.0 in $with_zstd" >&5
+$as_echo_n "checking for zstd >= 1.4.0 in $with_zstd... " >&6; }
+
+ zstd_save_CPPFLAGS=$CPPFLAGS
+ zstd_save_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $ZSTD_CFLAGS"
+ LIBS="$ZSTD_LIBS $LIBS"
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <zstd.h>
+#if ZSTD_VERSION_NUMBER < 10400
+# error zstd 1.4.0 or later is required
+#endif
+
+int
+main ()
+{
+
+ (void) ZSTD_compress(0, 0, 0, 0, 1);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ have_zstd=yes
+else
+ have_zstd=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ CPPFLAGS=$zstd_save_CPPFLAGS
+ LIBS=$zstd_save_LIBS
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_zstd" >&5
+$as_echo "$have_zstd" >&6; }
+
+ if test "$have_zstd" = yes; then :
+
+ pkg_cv_ZSTD_CFLAGS=$ZSTD_CFLAGS
+ pkg_cv_ZSTD_LIBS=$ZSTD_LIBS
+
+$as_echo "#define HAVE_ZSTD 1" >>confdefs.h
+
+
+else
+
+ as_fn_error $? "zstd >= 1.4.0 was not found under $with_zstd" "$LINENO" 5
fi
+ ;; #(
+ *) :
+ ;;
+esac
+
+
+
# target-specific stuff:
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-27 11:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27 11:48 [PATCH] configure: Support --with-zstd=PATH Torbjörn SVENSSON
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox