Skip to content

Commit

Permalink
Use zstd with configure.ac
Browse files Browse the repository at this point in the history
  • Loading branch information
perkfly committed Apr 17, 2024
1 parent b67c97d commit 4ab9ab8
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 15 deletions.
12 changes: 7 additions & 5 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ build = @build@
static_build = @static_build@
# Whether the user provided a specific find for zlib
with_zlib = @with_zlib@
# Whether the user provided a specific find for libzstd
with_zstd = @with_zstd@
# Path to be passed to curl's --with-ca-bundle configure option.
with_ca_bundle = @with_ca_bundle@
# Path to be passed to curl's --with-ca-path configure option.
with_ca_path = @with_ca_path@
# Path to be passed to curl's --with-libnssckbi configure option (an option
# added for curl-impersonate).
with_libnssckbi = @with_libnssckbi@

CC = @CC@
CXX = @CXX@
Expand Down Expand Up @@ -317,7 +316,6 @@ $(CURL_VERSION)/.firefox: $(firefox_libs) $(CURL_VERSION).tar.xz $(CURL_VERSION)
config_flags+=" --with-nghttp2=$(nghttp2_install_dir)"; \
config_flags+=" --with-brotli=$(brotli_install_dir)"; \
config_flags+=" --with-nss=$(nss_install_dir) --with-nss-deprecated"; \
config_flags+=" --with-zstd"; \
config_flags+=" --enable-websockets"; \
config_flags+=" --enable-ipv6"; \
config_flags+=" USE_CURL_SSLKEYLOGFILE=true"; \
Expand Down Expand Up @@ -360,7 +358,6 @@ $(CURL_VERSION)/.chrome: $(chrome_libs) $(CURL_VERSION).tar.xz $(CURL_VERSION)/.
config_flags="$$config_flags --with-nghttp2=$(nghttp2_install_dir)"; \
config_flags="$$config_flags --with-brotli=$(brotli_install_dir)"; \
config_flags="$$config_flags --with-openssl=$(boringssl_install_dir)"; \
config_flags="$$config_flags --with-zstd"; \
config_flags="$$config_flags --enable-websockets"; \
config_flags="$$config_flags --enable-ech"; \
config_flags="$$config_flags --enable-ipv6"; \
Expand All @@ -376,6 +373,11 @@ $(CURL_VERSION)/.chrome: $(chrome_libs) $(CURL_VERSION).tar.xz $(CURL_VERSION)/.
else \
config_flags+=" --with-zlib"; \
fi; \
if test -n "$(with_zstd)"; then \
config_flags="$$config_flags --with-zstd=$(with_zstd)"; \
else \
config_flags+=" --with-zstd"; \
fi; \
if test -n "$(with_ca_bundle)"; then \
config_flags="$$config_flags --with-ca-bundle=$(with_ca_bundle)"; \
fi; \
Expand Down
89 changes: 80 additions & 9 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for curl-impersonate 0.5.0.
# Generated by GNU Autoconf 2.71 for curl-impersonate 0.7.0.
#
# Report bugs to <[email protected]>.
#
Expand Down Expand Up @@ -610,8 +610,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='curl-impersonate'
PACKAGE_TARNAME='curl-impersonate'
PACKAGE_VERSION='0.5.0'
PACKAGE_STRING='curl-impersonate 0.5.0'
PACKAGE_VERSION='0.7.0'
PACKAGE_STRING='curl-impersonate 0.7.0'
PACKAGE_BUGREPORT='[email protected]'
PACKAGE_URL=''

Expand All @@ -622,6 +622,7 @@ cmake
with_libnssckbi
with_ca_path
with_ca_bundle
with_zstd
with_zlib
static_build
STRIP
Expand Down Expand Up @@ -687,6 +688,7 @@ ac_user_opts='
enable_option_checking
enable_static
with_zlib
with_zstd
with_ca_bundle
with_ca_path
with_libnssckbi
Expand Down Expand Up @@ -1250,7 +1252,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures curl-impersonate 0.5.0 to adapt to many kinds of systems.
\`configure' configures curl-impersonate 0.7.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1317,7 +1319,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of curl-impersonate 0.5.0:";;
short | recursive ) echo "Configuration of curl-impersonate 0.7.0:";;
esac
cat <<\_ACEOF
Expand All @@ -1332,6 +1334,7 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-zlib=PATH Search for zlib in PATH. Useful when cross compiling
--with-zstd=PATH Search for zstd in PATH. Useful when cross compiling
--with-ca-bundle=FILE Path to be passed to curl's --with-ca-bundle
configure option. Useful when cross compiling.
Relevant only for the Chrome build.
Expand Down Expand Up @@ -1422,7 +1425,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
curl-impersonate configure 0.5.0
curl-impersonate configure 0.7.0
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1584,7 +1587,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by curl-impersonate $as_me 0.5.0, which was
It was created by curl-impersonate $as_me 0.7.0, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -4180,6 +4183,74 @@ else $as_nop
fi
# Let the user optionally specify the path to zstd, the same for zlib
# Check whether --with-zstd was given.
if test ${with_zstd+y}
then :
withval=$with_zstd; with_zstd="$withval"
else $as_nop
with_zstd="check"
fi
if # User provided --without-zstd, which we don't support
test x"$with_zstd" = xno
then :
as_fn_error $? "building without zstd is not supported" "$LINENO" 5
elif # User didn't provide --with-zstd at all, or provided --with-zstd without
# a path. Check if zstd can be linked against using the default linker flags.
test x"$with_zstd" = xcheck -o x"$with_zstd" = xyes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ZSTD_decompress in -lzstd" >&5
printf %s "checking for ZSTD_decompress in -lzstd... " >&6; }
if test ${ac_cv_lib_zstd_ZSTD_decompress+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lzstd $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char ZSTD_decompress ();
int
main (void)
{
return ZSTD_decompress ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_zstd_ZSTD_decompress=yes
else $as_nop
ac_cv_lib_zstd_ZSTD_decompress=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zstd_ZSTD_decompress" >&5
printf "%s\n" "$ac_cv_lib_zstd_ZSTD_decompress" >&6; }
if test "x$ac_cv_lib_zstd_ZSTD_decompress" = xyes
then :
with_zstd=""
else $as_nop
as_fn_error $? "failed to find zstd" "$LINENO" 5
fi
else $as_nop
# User provided --with-zstd with a path.
with_zstd="$with_zstd"
fi
# Path to CA certificates.
# These options will be passed as-is to curl's configure script.
# Useful when cross compiling, since curl's configure script doesn't know
Expand Down Expand Up @@ -4859,7 +4930,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by curl-impersonate $as_me 0.5.0, which was
This file was extended by curl-impersonate $as_me 0.7.0, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -4914,7 +4985,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
curl-impersonate config.status 0.5.0
curl-impersonate config.status 0.7.0
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
Expand Down
22 changes: 21 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([curl-impersonate], [0.5.4], [[email protected]])
AC_INIT([curl-impersonate], [0.7.0], [[email protected]])

AC_CANONICAL_BUILD
AC_CANONICAL_HOST
Expand Down Expand Up @@ -36,6 +36,26 @@ AS_IF(
# User provided --with-zlib with a path.
[AC_SUBST([with_zlib], ["$with_zlib"])])

# Let the user optionally specify the path to zstd, the same for zlib
AC_ARG_WITH([zstd],
[AS_HELP_STRING([--with-zstd=PATH],
[Search for zstd in PATH. Useful when cross compiling])],
[with_zstd="$withval"],
[with_zstd="check"])

AS_IF(
# User provided --without-zstd, which we don't support
[test x"$with_zstd" = xno],
[AC_MSG_ERROR(building without zstd is not supported)],
# User didn't provide --with-zstd at all, or provided --with-zstd without
# a path. Check if zstd can be linked against using the default linker flags.
[test x"$with_zstd" = xcheck -o x"$with_zstd" = xyes],
[AC_CHECK_LIB([zstd], [ZSTD_decompress],
[AC_SUBST([with_zstd], [""])],
[AC_MSG_ERROR(failed to find zstd)])],
# User provided --with-zstd with a path.
[AC_SUBST([with_zstd], ["$with_zstd"])])

# Path to CA certificates.
# These options will be passed as-is to curl's configure script.
# Useful when cross compiling, since curl's configure script doesn't know
Expand Down

0 comments on commit 4ab9ab8

Please sign in to comment.