1dnl Template file for GNU Autoconf 2dnl Copyright (C) 2015-2021 Free Software Foundation, Inc. 3 4dnl This program is free software; you can redistribute it and/or modify 5dnl it under the terms of the GNU General Public License as published by 6dnl the Free Software Foundation; either version 3 of the License, or 7dnl (at your option) any later version. 8 9dnl This program is distributed in the hope that it will be useful, 10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12dnl GNU General Public License for more details. 13 14dnl You should have received a copy of the GNU General Public License 15dnl along with this program. If not, see <http://www.gnu.org/licenses/>. 16 17# Process this file with autoconf to produce a configure script. 18 19dnl Error if AX_CODE_COVERAGE if missing. 20m4_pattern_forbid([^_?AX_]) 21m4_pattern_allow([AX_CHECK_GNU_MAKE_HEADLINE]) 22m4_pattern_allow([_AX_CODE_COVERAGE_GCOV_PROG_WITH]) 23 24CFLAGS=$CFLAGS 25LDFLAGS=$LDFLAGS 26 27AC_PREREQ([2.69]) 28AC_INIT([wget2],[2.0.0],[bug-wget@gnu.org],[wget2],[https://savannah.gnu.org/projects/wget]) 29 30AC_CONFIG_MACRO_DIR([m4]) 31AC_CONFIG_AUX_DIR([build-aux]) 32 33AM_INIT_AUTOMAKE([subdir-objects parallel-tests gnu -Wno-portability dist-lzip]) 34 35AC_CANONICAL_HOST 36case $host_os in 37 linux*) 38 ;; 39 mingw*) 40 XTRA_CFLAGS="-Wno-attributes -fno-PIC" 41# XTRA_LIBS=-lws2_32 42 ;; 43 cygwin*) 44 XTRA_CFLAGS="-Wno-char-subscripts -fno-PIC" 45 ;; 46# *) 47# AC_MSG_ERROR([$host_os is not currently supported]) 48# ;; 49esac 50 51# Append EXTRA_CFLAGS to CFLAGS, if defined. 52test -n "$EXTRA_CFLAGS" && CFLAGS="$CFLAGS $EXTRA_CFLAGS" 53test -n "$XTRA_CFLAGS" && CFLAGS="$CFLAGS $XTRA_CFLAGS" 54 55AC_USE_SYSTEM_EXTENSIONS 56AC_PROG_CC 57if test "$ac_cv_prog_cc_c99" = "no"; then 58 AC_MSG_ERROR(Compiler does not support C99. Aborting.) 59fi 60 61gl_EARLY 62gl_INIT 63 64AX_CODE_COVERAGE 65 66LT_PREREQ([2.2]) 67LT_INIT([dlopen]) 68 69# Define these substitutions here to keep all version information in one place. 70# For information on how to properly maintain the library version information, 71# refer to the libtool manual, section "Updating library version information": 72# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html 73# 74# 1. Start with version information of ‘0:0:0’ for each libtool library. 75# 2. Update the version information only immediately before a public release of your software. More frequent updates are unnecessary, and only guarantee that the current interface number gets larger faster. 76# 3. If the library source code has changed at all since the last update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’). 77# 4. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0. 78# 5. If any interfaces have been added since the last public release, then increment age. 79# 6. If any existing interfaces have been removed or changed since the last public release, then set age to 0. 80AC_SUBST([LIBWGET_SO_VERSION], [1:0:0]) 81AC_SUBST([LIBWGET_VERSION], [2.0.0]) 82 83# 84# Generate version defines for include file 85# 86AC_SUBST([LIBWGET_VERSION_MAJOR], [`echo $LIBWGET_VERSION|cut -d'.' -f1`]) 87AC_SUBST([LIBWGET_VERSION_MINOR], [`echo $LIBWGET_VERSION|cut -d'.' -f2`]) 88AC_SUBST([LIBWGET_VERSION_PATCH], [`echo $LIBWGET_VERSION|cut -d'.' -f3`]) 89AC_SUBST([LIBWGET_VERSION_NUMBER], [`printf '0x%02x%02x%02x' $LIBWGET_VERSION_MAJOR $LIBWGET_VERSION_MINOR $LIBWGET_VERSION_PATCH`]) 90AC_CONFIG_FILES([include/wget/wgetver.h]) 91 92AC_CONFIG_SRCDIR([src/wget.c]) 93AC_CONFIG_HEADERS([config.h]) 94 95# Non-verbose make 96m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 97 98# Check for large file support. This check needs to come fairly 99# early because it could (in principle) affect whether functions and 100# headers are available, whether they work, etc. 101AC_SYS_LARGEFILE 102AC_CHECK_SIZEOF(off_t) 103 104# Checks for programs. 105 106AC_PROG_LEX([noyywrap]) 107AC_PROG_INSTALL 108AC_PROG_LN_S 109 110# enable all possible compiler warnings in WARN_FLAGS 111# 112# to enable by default: create a file '.manywarnings' 113# enable explicitly : ./configure --enable-manywarnings 114# disable explicitly: ./configure --disable-manywarnings 115wget_MANYWARNINGS(WARN_CFLAGS, C) 116 117if test -n "$WARN_CFLAGS"; then 118 if test "$CCNAME" = "gcc"; then 119 # Set up list of unwanted warnings 120 nw= 121 nw="$nw -Wsystem-headers" # System headers may trigger lot's of useless warnings 122 nw="$nw -Wvla" # This project is C99 123 nw="$nw -Wstack-protector" 124 nw="$nw -Wmissing-field-initializer" 125 nw="$nw -Wtraditional" 126 nw="$nw -Wtraditional-conversion" 127 nw="$nw -Wc++-compat" 128 nw="$nw -Wcast-qual" 129 nw="$nw -Wconversion" 130 nw="$nw -Wsign-conversion" 131 nw="$nw -Wunsuffixed-float-constants" 132 nw="$nw -Wdeclaration-after-statement" # C89 only, messing up gcc < 5 133 nw="$nw -Wcast-function-type" # gcc 8, very noisy 134 nw="$nw -Wabi" # gcc 8, very noisy 135 nw="$nw -Wunused-macros" # triggers in auto-generated lex css parser, #pragma doesn't work, conflicts with -Werror 136 nw="$nw -Wchkp" # gcc-9 says: not supported any more (but emits it via -Q --help=C)" 137 if test "$cross_compiling" = yes; then 138 nw="$nw -Wformat" 139 fi 140 141 # remove unwanted warn flags 142 wget_WORD_REMOVE([WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) 143 144 # add more flags as you like 145 if test $GCC_VERSION -ge 5; then 146 WARN_CFLAGS="$WARN_CFLAGS -fdiagnostics-color=always" 147 fi 148 if test "$cross_compiling" = yes; then 149 WARN_CFLAGS="$WARN_CFLAGS -Wno-format" 150 fi 151 if test $GCC_VERSION -ge 8; then 152 WARN_CFLAGS="$WARN_CFLAGS -Wno-cast-function-type" 153 fi 154 # WARN_CFLAGS="$WARN_CFLAGS -Werror" 155 156 # We use a slightly smaller set of warning options for lib/. 157 # Remove the following and save the result in GNULIB_WARN_CFLAGS. 158 # Removing is not enough if these switches are implicitly set by other 159 # flags like -Wall or -Wextra. We have to explicitly unset them 160 # with -Wno-.... 161 nw= 162 nw="$nw -Wpedantic" 163 nw="$nw -Wsign-compare" 164 nw="$nw -Wunused-parameter" 165 nw="$nw -Wswitch-default" 166 nw="$nw -Wformat-nonliteral" 167 nw="$nw -Wsuggest-attribute=pure" 168 nw="$nw -Wunsafe-loop-optimizations" 169 nw="$nw -Wundef" 170 nw="$nw -Wswitch-enum" 171 nw="$nw -Wbad-function-cast" 172 nw="$nw -Wredundant-decls" 173 nw="$nw -Werror" 174 wget_WORD_REMOVE([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) 175 wget_WORD_REMOVE([CFLAGS], [$CFLAGS], [-Werror]) 176 177 # disable options implicitly set by other options 178 GNULIB_WARN_CFLAGS="-Wno-error $GNULIB_WARN_CFLAGS" 179 GNULIB_WARN_CFLAGS="$GNULIB_WARN_CFLAGS -Wno-sign-compare -Wno-unused-parameter -Wno-alloca" 180 GNULIB_WARN_CFLAGS="$GNULIB_WARN_CFLAGS -Wno-float-conversion -Wno-cast-function-type" 181 if test "$cross_compiling" = yes; then 182 GNULIB_WARN_CFLAGS="$GNULIB_WARN_CFLAGS -Wno-incompatible-pointer-types" 183 fi 184 185 elif test "$CCNAME" = "clang"; then 186 # setup flags for this project 187 WARN_CFLAGS="$WARN_CFLAGS -Wno-system-headers -Wno-vla -Wno-cast-qual -Wno-padded" 188 WARN_CFLAGS="$WARN_CFLAGS -Wno-reserved-id-macro -Wno-sign-conversion -Wno-disabled-macro-expansion" 189 WARN_CFLAGS="$WARN_CFLAGS -Wno-documentation -Wno-documentation-unknown-command" 190 WARN_CFLAGS="$WARN_CFLAGS -Wno-covered-switch-default -Wno-unused-macros" 191 WARN_CFLAGS="$WARN_CFLAGS -Wno-missing-field-initializers" 192 WARN_CFLAGS="$WARN_CFLAGS -Wno-nullability-extension -Wno-nullability-completeness" 193 194 CLANG_VERSION=$($CC -dumpversion | cut -f1 -d.) 195 if test $CLANG_VERSION -ge 11; then 196 WARN_CFLAGS="$WARN_CFLAGS -Wno-implicit-int-float-conversion" 197 fi 198 199 # remove all flags from WARN_FLAGS that are already in CFLAGS 200 # wget_WORD_REMOVE([WARN_CFLAGS], [$WARN_CFLAGS], [$CFLAGS]) 201 202 wget_WORD_REMOVE([CFLAGS], [$CFLAGS], [-Werror]) 203 204 # disable verbose options 205 GNULIB_WARN_CFLAGS="-Wno-error $GNULIB_WARN_CFLAGS" 206 GNULIB_WARN_CFLAGS="$WARN_CFLAGS -Wno-sign-compare -Wno-unused-parameter -Wno-undef -Wno-format-nonliteral" 207 GNULIB_WARN_CFLAGS="$GNULIB_WARN_CFLAGS -Wno-conversion -Wno-disabled-macro-expansion -Wno-c++98-compat" 208 GNULIB_WARN_CFLAGS="$GNULIB_WARN_CFLAGS -Wno-gnu-statement-expression -Wno-shorten-64-to-32 -Wno-switch-enum" 209 GNULIB_WARN_CFLAGS="$GNULIB_WARN_CFLAGS -Wno-unused-macros -Wno-missing-field-initializers" 210 GNULIB_WARN_CFLAGS="$GNULIB_WARN_CFLAGS -Wno-gnu-zero-variadic-macro-arguments -Wno-conditional-uninitialized" 211 GNULIB_WARN_CFLAGS="$GNULIB_WARN_CFLAGS -Wno-comma -Wno-assign-enum -Wno-unreachable-code -Wno-error" 212 GNULIB_WARN_CFLAGS="$GNULIB_WARN_CFLAGS -Wno-missing-field-initializers -Wno-used-but-marked-unused" 213 214 # remove all flags from GNULIB_WARN_FLAGS that are already in CFLAGS 215 # wget_WORD_REMOVE([GNULIB_WARN_CFLAGS], [$GNULIB_WARN_CFLAGS], [$CFLAGS]) 216 fi 217 218 AC_SUBST([MANYWARNINGS], [-DWGET_MANYWARNINGS]) 219 AC_SUBST([WARN_CFLAGS]) 220 AC_SUBST([GNULIB_WARN_CFLAGS]) 221fi 222 223AC_ARG_ENABLE([manylibs], 224 [AS_HELP_STRING([--disable-manylibs], [Generate small libraries of libwget functionality groups])], 225 [enable_manylibs=$enableval], [enable_manylibs=yes]) 226AM_CONDITIONAL([ENABLE_MANYLIBS], [test "$enable_manylibs" = "yes"]) 227 228AC_ARG_ENABLE([fuzzing], 229 [AS_HELP_STRING([--enable-fuzzing], [Turn on fuzzing build (for developers)])], 230 [enable_fuzzing=yes; AC_SUBST([LIB_FUZZING_ENGINE])], [enable_fuzzing=no; LIB_FUZZING_ENGINE=""]) 231AM_CONDITIONAL([FUZZING], [test -n "$LIB_FUZZING_ENGINE"]) 232 233AC_ARG_ENABLE([fsanitize-ubsan], 234 [AS_HELP_STRING([--enable-fsanitize-ubsan], [Turn on Undefined Behavior Sanitizer (for developers)])], 235 [gl_cc_sanitize_ubsan=yes], [gl_cc_sanitize_ubsan=no]) 236 237AC_ARG_ENABLE([fsanitize-asan], 238 [AS_HELP_STRING([--enable-fsanitize-asan], [Turn on Address Sanitizer (for developers) (mutually exclusive with Memory/Thread sanitizer or Valgrind tests)])], 239 [gl_cc_sanitize_asan=yes], [gl_cc_sanitize_asan=no]) 240 241AC_ARG_ENABLE([fsanitize-msan], 242 [AS_HELP_STRING([--enable-fsanitize-msan], [Turn on Memory Sanitizer (for developers) (mutually exclusive with Address/Thread sanitizer or Valgrind tests)])], 243 [gl_cc_sanitize_msan=yes], [gl_cc_sanitize_msan=no]) 244 245AC_ARG_ENABLE([fsanitize-tsan], 246 [AS_HELP_STRING([--enable-fsanitize-tsan], [Turn on Thread Sanitizer (for developers) (mutually exclusive with Address/Memory sanitizer or Valgrind tests)])], 247 [gl_cc_sanitize_tsan=yes], [gl_cc_sanitize_tsan=no]) 248 249 250if test "$gl_cc_sanitize_asan" = yes; then 251 if test "$gl_cc_sanitize_msan" = yes; then 252 AC_MSG_ERROR([Address Sanitizer and Memory Sanitizer are mutually exclusive]) 253 elif test "$gl_cc_sanitize_tsan" = yes; then 254 AC_MSG_ERROR([Address Sanitizer and Thread Sanitizer are mutually exclusive]) 255 fi 256fi 257 258 259if test "$gl_cc_sanitize_msan" = yes; then 260 if test "$gl_cc_sanitize_tsan" = yes; then 261 AC_MSG_ERROR([Memory Sanitizer and Thread Sanitizer are mutually exclusive]) 262 fi 263fi 264 265 266if test "$gl_cc_sanitize_ubsan" = yes; then 267 gl_WARN_ADD([-fsanitize=undefined]) 268 gl_WARN_ADD([-fsanitize=bool]) 269 gl_WARN_ADD([-fsanitize=alignment]) 270 gl_WARN_ADD([-fsanitize=null]) 271 gl_WARN_ADD([-fsanitize=enum]) 272 gl_WARN_ADD([-fsanitize=bounds-strict]) 273 274 # additional clang options, from OSS-Fuzz (20.12.2019) 275 gl_WARN_ADD([-fsanitize=integer]) 276 gl_WARN_ADD([-fsanitize=array-bounds]) 277 gl_WARN_ADD([-fsanitize=builtin]) 278 gl_WARN_ADD([-fsanitize=float-divide-by-zero]) 279 gl_WARN_ADD([-fsanitize=function]) 280 gl_WARN_ADD([-fsanitize=integer-divide-by-zero]) 281 gl_WARN_ADD([-fsanitize=object-size]) 282 gl_WARN_ADD([-fsanitize=return]) 283 gl_WARN_ADD([-fsanitize=returns-nonnull-attribute]) 284 gl_WARN_ADD([-fsanitize=shift]) 285 gl_WARN_ADD([-fsanitize=signed-integer-overflow]) 286 gl_WARN_ADD([-fsanitize=unsigned-integer-overflow]) 287 gl_WARN_ADD([-fsanitize=unreachable]) 288 gl_WARN_ADD([-fsanitize=vla-bound]) 289 gl_WARN_ADD([-fsanitize=vptr]) 290fi 291 292if test "$gl_cc_sanitize_asan" = yes; then 293 gl_WARN_ADD([-fsanitize=address]) 294 gl_WARN_ADD([-fsanitize=leak]) 295 gl_WARN_ADD([-fsanitize=nonnull-attribute]) 296 gl_WARN_ADD([-fno-omit-frame-pointer]) 297 298 # additional clang option 299 gl_WARN_ADD([-fsanitize-address-use-after-scope]) 300fi 301 302if test "$gl_cc_sanitize_ubsan" = yes || test "$gl_cc_sanitize_asan" = yes; then 303 gl_WARN_ADD([-fno-sanitize-recover=all]) 304 gl_WARN_ADD([-fsanitize-recover=unsigned-integer-overflow]) 305fi 306 307if test "$gl_cc_sanitize_msan" = yes; then 308 # clang options 309 gl_WARN_ADD([-fsanitize=memory]) 310 gl_WARN_ADD([-fsanitize-memory-track-origins]) 311 312 # gcc options 313 if test "$CCNAME" = "gcc"; then 314 gl_WARN_ADD([-fsanitize=leak]) 315 fi 316 317 gl_WARN_ADD([-fno-omit-frame-pointer]) 318 gl_WARN_ADD([-fPIE]) 319fi 320 321if test "$gl_cc_sanitize_tsan" = yes; then 322 gl_WARN_ADD([-fsanitize=thread -fPIC -pie]) 323fi 324 325# 326# Assertions 327# 328AC_ARG_ENABLE([assert], 329 [AS_HELP_STRING([--enable-assert], [Enable assertions in code (for developers)])], 330 [ENABLE_ASSERT=$enableval], [ENABLE_ASSERT=no]) 331 332AS_IF([test "$ENABLE_ASSERT" != "yes"], [CFLAGS="-DNDEBUG $CFLAGS"], []) 333 334# 335# xattr 336# 337AC_ARG_ENABLE([xattr], 338 [AS_HELP_STRING([--disable-xattr], [disable support for POSIX Extended Attributes])], 339 [ENABLE_XATTR=$enableval], 340 [ENABLE_XATTR=yes]) 341 342case "$host_os" in 343 *linux* | *darwin*) xattr_syscalls="fsetxattr" ;; 344 freebsd*) xattr_syscalls="extattr_set_fd" ;; 345 *) AC_MSG_NOTICE([Disabling Extended Attribute support: your system is not known to support extended attributes.]) 346 ENABLE_XATTR=no 347esac 348 349if test "${ENABLE_XATTR}" = "yes" ; then 350 AC_CHECK_FUNCS([$xattr_syscalls], [], [ 351 AC_MSG_NOTICE([Disabling Extended Attribute support: your system does not support $xattr_syscalls]) 352 ENABLE_XATTR=no 353 ]) 354fi 355 356test "${ENABLE_XATTR}" = "yes" && AC_DEFINE([ENABLE_XATTR], 1, 357 [Define if you want file meta-data storing into POSIX Extended Attributes compiled in.]) 358 359# 360# Gettext 361# 362m4_ifdef([AM_GNU_GETTEXT], [ 363 AM_GNU_GETTEXT([external],[need-ngettext]) 364 AC_CONFIG_FILES([po/Makefile.in]) 365 have_po=yes 366], [ 367 have_po=no 368]) 369m4_ifdef([AM_GNU_GETTEXT_VERSION], [ 370#do not indent here 371AM_GNU_GETTEXT_VERSION([0.19.3]) 372]) 373AM_CONDITIONAL([HAVE_PO], [ test "$have_po" = "yes" ]) 374 375# 376# check for doxygen and pandoc 377# 378AC_ARG_ENABLE(doc, AS_HELP_STRING([--disable-doc], [don t generate any documentation]), 379 enable_doc=$enableval, enable_doc=yes) 380if test "$enable_doc" = yes; then 381 AC_CHECK_PROGS([DOXYGEN], [doxygen-not-found]) 382 AC_CHECK_PROGS([PANDOC], [pandoc]) 383 384 if test -n "$DOXYGEN" || test -n "$PANDOC"; then 385 LIBWGET_DOCS_INFO="yes (found:" 386 if test -n "$DOXYGEN"; then 387 LIBWGET_DOCS_INFO="$LIBWGET_DOCS_INFO Doxygen)" 388 else 389 LIBWGET_DOCS_INFO="no" 390 fi 391 WGET2_DOCS_INFO="yes (found:" 392 if test -n "$PANDOC"; then 393 WGET2_DOCS_INFO="$WGET2_DOCS_INFO Pandoc)" 394 else 395 WGET2_DOCS_INFO="no" 396 fi 397 else 398 DOCS_INFO="no (neither Doxygen nor Pandoc found)" 399 fi 400else 401 DOCS_INFO="no (disabled)" 402fi 403AM_CONDITIONAL([WITH_DOCS], [ test -n "$DOXYGEN" || test -n "$PANDOC" ]) 404AM_CONDITIONAL([WITH_DOXYGEN], [ test -n "$DOXYGEN" ]) 405AM_CONDITIONAL([WITH_PANDOC], [ test -n "$PANDOC" ]) 406 407# 408# enable creation of man pages 409# 410#AC_ARG_ENABLE(man,[AS_HELP_STRING([--enable-man], 411# [generate man pages [default=auto]])],enable_man=yes,enable_man=no) 412 413#AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != "no") 414#AC_MSG_CHECKING([whether to generate man pages]) 415#AS_IF([test "$enable_man" != no], [ 416# AC_MSG_RESULT([yes]) 417#], [ 418# AC_MSG_RESULT([no]) 419#]) 420 421 422# Check for ldconfig 423AC_CHECK_PROG(LDCONFIG, ldconfig, ldconfig, :) 424 425# Check for valgrind 426AC_ARG_ENABLE(valgrind-tests, 427 AS_HELP_STRING([--enable-valgrind-tests], [enable using Valgrind for tests (mutually exclusive with Address/Memory/Thread sanitizer)]), 428 [ac_enable_valgrind=$enableval], [ac_enable_valgrind=no]) 429AS_IF([test "${ac_enable_valgrind}" != "no"], [ 430 AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no) 431 AS_IF([test "$HAVE_VALGRIND" = "yes"], [ 432 VALGRIND_TESTS="1" 433 AC_SUBST(VALGRIND_TESTS) 434 TESTS_INFO="Test suite will be run under Valgrind" 435 ], [ 436 TESTS_INFO="Valgrind not found" 437 ]) 438], [ 439 TESTS_INFO="Valgrind testing not enabled" 440]) 441 442 443if test "$VALGRIND_TESTS" = 1; then 444 if test "$gl_cc_sanitize_asan" = yes; then 445 AC_MSG_ERROR([Valgrind and Address Sanitizer are mutually exclusive]) 446 elif test "$gl_cc_sanitize_msan" = yes; then 447 AC_MSG_ERROR([Valgrind and Memory Sanitizer are mutually exclusive]) 448 elif test "$gl_cc_sanitize_tsan" = yes; then 449 AC_MSG_ERROR([Valgrind and Thread Sanitizer are mutually exclusive]) 450 fi 451fi 452 453# check for pandoc (documentation converter) 454 455# check for gcc's atomic read-add-write functionality 456AC_MSG_CHECKING([for __sync_fetch_and_add (int)]) 457AC_LINK_IFELSE( 458 [AC_LANG_SOURCE([ 459 int main(void) { return __sync_fetch_and_add((int *)0, 0); } 460 ])], 461 [AC_DEFINE([WITH_SYNC_FETCH_AND_ADD], [1], [use __sync_fetch_and_add]) AC_MSG_RESULT([yes])], 462 [AC_MSG_RESULT([no])] 463) 464AC_MSG_CHECKING([for __sync_fetch_and_add (long long)]) 465AC_LINK_IFELSE( 466 [AC_LANG_SOURCE([ 467 int main(void) { return __sync_fetch_and_add((long long *)0, 0); } 468 ])], 469 [AC_DEFINE([WITH_SYNC_FETCH_AND_ADD_LONGLONG], [1], [use __sync_fetch_and_add]) AC_MSG_RESULT([yes])], 470 [AC_MSG_RESULT([no])] 471) 472 473PKG_PROG_PKG_CONFIG 474 475AC_ARG_WITH(ssl, AS_HELP_STRING([--with-ssl], [Use SSL/TLS with specified library. Options: 'gnutls' (default), 'openssl', 'wolfssl' or 'none']), with_ssl=$withval, with_ssl="yes") 476 477AS_IF([test "$with_ssl" = "gnutls" || test "$with_ssl" = "yes"], [ 478 PKG_CHECK_MODULES([GNUTLS], [gnutls], [ 479 with_gnutls=yes 480 LIBS="$GNUTLS_LIBS $LIBS" 481 CFLAGS="$GNUTLS_CFLAGS $CFLAGS" 482 AC_DEFINE([WITH_GNUTLS], [1], [Use GnuTLS]) 483 AC_DEFINE([WITH_GNUTLS_IN_TESTSUITE], [1], [GnuTLS is available for test suite.]) 484 AC_SEARCH_LIBS(gnutls_hash, gnutls, [with_gnutls_hash=yes]) 485 AS_IF([test "$with_gnutls_hash" = "yes"], 486 [AC_CHECK_HEADERS([gnutls/crypto.h], [], [], [#include <gnutls/gnutls.h>])]) 487 AC_CHECK_HEADERS([gnutls/ocsp.h], 488 [AC_DEFINE([WITH_OCSP], [1], [OCSP is supported.]) 489 AC_DEFINE([WITH_GNUTLS_OCSP], [1], [GnuTLS OCSP is supported for test suite.])], 490 [AC_MSG_WARN(*** Header file gnutls/ocsp.h was not found. OCSP will be disabled.)]) 491 AC_CHECK_FUNCS(gnutls_srp_server_get_username gnutls_transport_get_int) 492 ], [ 493 AC_SEARCH_LIBS(gnutls_global_init, gnutls, 494 [with_gnutls=yes], 495 [AC_MSG_WARN(*** GNUTLS was not found. Fallback to libnettle for hashing and checksumming.)]) 496 ]) 497]) 498 499AS_IF([test "$with_ssl" = "openssl" || (test "$with_ssl" = "yes" && test "$with_gnutls" != "yes")], [ 500 PKG_CHECK_MODULES([OPENSSL], [openssl], [ 501 with_openssl=yes 502 LIBS="$OPENSSL_LIBS $LIBS" 503 CFLAGS="$OPENSSL_CFLAGS $CFLAGS" 504 AC_DEFINE([WITH_OPENSSL], [1], [Use OpenSSL]) 505 ], [ 506 AC_SEARCH_LIBS(SSL_CTX_new, ssl, 507 [with_openssl=yes; AC_DEFINE([WITH_OPENSSL], [1], [Use OpenSSL])], 508 [AC_MSG_WARN(*** OpenSSL was not found.) 509 ]) 510 ]) 511 512 AS_IF([test "$with_openssl" = "yes"], [ 513 AC_CHECK_HEADERS([openssl/ssl.h]) 514 AC_CHECK_HEADERS([openssl/x509_vfy.h]) 515 AC_CHECK_HEADERS([openssl/ocsp.h], 516 [AC_DEFINE([WITH_OCSP], [1], [OCSP is supported])], 517 [AC_MSG_WARN(*** Header file openssl/ocsp.h was not found. OCSP will be disabled.)]) 518 519 AC_CHECK_FUNCS(SSL_new X509_STORE_add_lookup) 520 521 AC_SEARCH_LIBS(EVP_MD_CTX_new, crypto, 522 [with_libcrypto=yes; AC_DEFINE([WITH_LIBCRYPTO], [1], [Use libcrypto])], 523 [with_libcrypto=no; AC_MSG_WARN(*** LIBCRYPTO was not found. Fallback to libwolfcrypt for hashing and checksumming.) 524 ]) 525 ]) 526]) 527 528AS_IF([test "$with_ssl" = "wolfssl" || (test "$with_ssl" = "yes" && test "$with_gnutls" != "yes" && test "$with_openssl" != "yes")], [ 529 PKG_CHECK_MODULES([WOLFSSL], [wolfssl], [ 530 with_wolfssl=yes 531 LIBS="$WOLFSSL_LIBS $LIBS" 532 CFLAGS="$WOLFSSL_CFLAGS $CFLAGS" 533 AC_DEFINE([WITH_WOLFSSL], [1], [Use WolfSSL]) 534 ], [ 535 AC_SEARCH_LIBS(wolfSSL_Init, wolfssl, 536 [with_wolfssl=yes; AC_DEFINE([WITH_WOLFSSL], [1], [Use WolfSSL])], 537 [AC_MSG_WARN(*** WolfSSL was not found.)]) 538 ]) 539 540 AS_IF([test "$with_wolfssl" = "yes"], [ 541 with_libwolfcrypt=yes 542 AC_DEFINE([WITH_LIBWOLFCRYPT], [1], [Use wolfcrypt]) 543 ]) 544]) 545 546AS_IF([test "$with_gnutls" = "yes" || test "$with_wolfssl" = "yes" || test "$with_openssl" = "yes"], [ 547 AC_DEFINE([WITH_TLS], [1], [Built with TLS support]) 548 AS_IF([test "$with_gnutls" = "yes"], [ssl_enabled="gnutls"], 549 [test "$with_openssl" = "yes"], [ssl_enabled="openssl"], 550 [test "$with_wolfssl" = "yes"], [ssl_enabled="wolfssl"], 551 [ssl_enabled="(not found)"]) 552], [ 553 AS_IF([test "$with_ssl" != "none"], [ 554 AS_IF([test "$with_ssl" == "yes"], [AC_MSG_ERROR([*** No SSL/TLS library not found.])], 555 [AC_MSG_ERROR([*** SSL/TLS library \"$with_ssl\" not found.])]) 556 ]) 557 ssl_enabled="none" 558]) 559 560#AS_IF([test "$with_gnutls" != "yes" && test "$with_openssl" != "yes" && test "$with_wolfssl" != "yes"], [ 561# AS_IF([test "$with_ssl" != "none"], [ 562# AC_MSG_ERROR([*** Unsupported value for --with-ssl. Use 'gnutls' (default), 'openssl', 'wolfssl' or 'none']) 563# ]) 564# ssl_enabled="(not found)" 565#]) 566 567AM_CONDITIONAL([WITH_GNUTLS], [test "$with_gnutls" = "yes"]) 568AM_CONDITIONAL([WITH_OPENSSL], [test "$with_openssl" = "yes"]) 569AM_CONDITIONAL([WITH_WOLFSSL], [test "$with_wolfssl" = "yes"]) 570 571AM_CONDITIONAL([WITH_TLS], [test "$with_gnutls" = "yes" || test "$with_wolfssl" = "yes" || test "$with_openssl" = "yes"]) 572 573AS_IF([(test "$with_gnutls" != "yes" || test "$with_gnutls_hash" != "yes") && test "$with_libwolfcrypt" != "yes" && test "$with_libcrypto" != "yes"], [ 574 PKG_CHECK_MODULES([NETTLE], nettle, [ 575 with_libnettle=yes 576 LIBS="$NETTLE_LIBS $LIBS" 577 CFLAGS="$NETTLE_CFLAGS $CFLAGS" 578 AC_DEFINE([WITH_LIBNETTLE], [1], [Use libnettle]) 579 ], [ 580 with_libnettle=no 581 AC_MSG_WARN(*** LIBNETTLE was not found. Fallback to libgcrypt for hashing and checksumming.) 582 ]) 583 584 AS_IF([test "$with_libnettle" != "yes"], [ 585 AC_SEARCH_LIBS(gcry_check_version, gcrypt, 586 [with_gcrypt=yes; AC_DEFINE([WITH_GCRYPT], [1], [Use libgcrypt]) AC_CHECK_HEADERS([gcrypt.h])], 587 [with_gcrypt=no; AC_MSG_WARN(*** LIBGCRYPT was not found. Fallback to gnulib for hashing and checksumming.)]) 588 ]) 589]) 590 591AM_CONDITIONAL([WITH_LIBNETTLE], [test "$with_libnettle" = "yes"]) 592AM_CONDITIONAL([WITH_CRYPT], [test "$with_gcrypt" = "yes"]) 593 594AC_ARG_WITH(libpsl, AS_HELP_STRING([--without-libpsl], [disable support for libpsl cookie checking]), with_libpsl=$withval, with_libpsl=yes) 595AS_IF([test "$with_libpsl" != "no"], [ 596 PKG_CHECK_MODULES([LIBPSL], libpsl, [ 597 with_libpsl=yes 598 # correct $LIBPSL_LIBS (in libpsl <= 0.6.0) 599 AS_IF([test "$LIBPSL_LIBS" = "-llibpsl "], [LIBPSL_LIBS="-lpsl"]) 600 LIBS="$LIBPSL_LIBS $LIBS" 601 CFLAGS="$LIBPSL_CFLAGS $CFLAGS" 602 AC_DEFINE([WITH_LIBPSL], [1], [PSL support enabled]) 603 ], [ 604 AC_SEARCH_LIBS(psl_builtin, psl, 605 [with_libpsl=yes; AC_DEFINE([WITH_LIBPSL], [1], [PSL support enabled])], 606 [with_libpsl=no; AC_MSG_WARN(*** libpsl was not found. Fallback to builtin cookie checking.)]) 607 ]) 608]) 609AM_CONDITIONAL([WITH_LIBPSL], [test "$with_libpsl" = "yes"]) 610 611AC_ARG_WITH(libhsts, AS_HELP_STRING([--without-libhsts], [disable support for libhsts checking]), with_libhsts=$withval, with_libhsts=yes) 612AS_IF([test "$with_libhsts" != "no"], [ 613 PKG_CHECK_MODULES([LIBHSTS], libhsts, [ 614 with_libhsts=yes 615 LIBS="$LIBHSTS_LIBS $LIBS" 616 CFLAGS="$LIBHSTS_CFLAGS $CFLAGS" 617 AC_DEFINE([WITH_LIBHSTS], [1], [HSTS Preload List support enabled]) 618 ], [ 619 AC_SEARCH_LIBS(hsts_get_version, hsts, 620 [with_libhsts=yes; AC_DEFINE([WITH_LIBHSTS], [1], [HSTS Preload List support enabled])], 621 [with_libhsts=no; AC_MSG_WARN(*** libhsts was not found.)]) 622 ]) 623]) 624AM_CONDITIONAL([WITH_LIBHSTS], [test "$with_libHSTS" = "yes"]) 625 626AC_ARG_WITH(libnghttp2, AS_HELP_STRING([--without-libnghttp2], [disable support for libnghttp2]), with_libnghttp2=$withval, with_libnghttp2=yes) 627AS_IF([test "$with_libnghttp2" != "no"], [ 628 PKG_CHECK_MODULES([LIBNGHTTP2], libnghttp2, [ 629 with_libnghttp2=yes 630 LIBS="$LIBNGHTTP2_LIBS $LIBS" 631 CFLAGS="$LIBNGHTTP2_CFLAGS $CFLAGS" 632 AC_DEFINE([WITH_LIBNGHTTP2], [1], [HTTP/2.0 support enabled via libnghttp2]) 633 ], [ 634 AC_SEARCH_LIBS(nghttp2_session_client_new, nghttp2, 635 [with_libnghttp2=yes; AC_DEFINE([WITH_LIBNGHTTP2], [1], [HTTP/2.0 support enabled via libnghttp2])], 636 [with_libnghttp2=no; AC_MSG_WARN(*** libnghttp2 was not found. HTTP/2.0 support disabled.)]) 637 ]) 638]) 639AM_CONDITIONAL([WITH_LIBNGHTTP2], [test "$with_libnghttp2" = "yes"]) 640 641AC_ARG_WITH(bzip2, AS_HELP_STRING([--without-bzip2], [disable bzip2 compression support]), with_bzip2=$withval, with_bzip2=yes) 642AS_IF([test "$with_bzip2" != "no"], [ 643 AC_SEARCH_LIBS(BZ2_bzDecompress, bz2, 644 [with_bzip2=yes; AC_SUBST([BZ2_LIBS], -lbz2) AC_DEFINE([WITH_BZIP2], [1], [Use libbz2])], 645 [with_bzip2=no; AC_MSG_WARN(*** libbz2 was not found. You will not be able to use BZIP2 (de)compression)]) 646]) 647AM_CONDITIONAL([WITH_BZIP2], [test "$with_bzip2" = "yes"]) 648 649AC_ARG_WITH(gpgme, AS_HELP_STRING([--without-gpgme], [support signature verification with gpgme]), with_gpgme=$withval, with_gpgme=yes) 650AS_IF([test "$with_gpgme" != "no"], [ 651 PKG_CHECK_MODULES([GPGME], gpgme, [ 652 with_gpgme=yes 653 LIBS="$GPGME_LIBS $LIBS" 654 CFLAGS="$GPGME_CFLAGS $CFLAGS" 655 AC_DEFINE([WITH_GPGME], [1], [Use gpgme]) 656 ], [ 657 m4_ifdef([AM_PATH_GPGME],[ 658 AM_PATH_GPGME([], [ 659 with_gpgme=yes 660 LIBS="$GPGME_LIBS $LIBS" 661 CFLAGS="$GPGME_CFLAGS $CFLAGS" 662 AC_DEFINE([WITH_GPGME], [1], [Use gpgme]) 663 ],[ 664 with_gpgme=no; AC_MSG_WARN(*** GPGME not found.) 665 ]) 666 ], [ 667 with_gpgme=no; AC_MSG_WARN(*** GPGME not found. Signature verification is not possible) 668 ]) 669 ]) 670]) 671AM_CONDITIONAL([WITH_GPGME], [test "$with_gpgme" = "yes"]) 672 673AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib], [disable gzip compression support]), with_zlib=$withval, with_zlib=yes) 674AS_IF([test "$with_zlib" != "no"], [ 675 PKG_CHECK_MODULES([ZLIB], zlib, [ 676 with_zlib=yes 677 LIBS="$ZLIB_LIBS $LIBS" 678 CFLAGS="$ZLIB_CFLAGS $CFLAGS" 679 AC_DEFINE([WITH_ZLIB], [1], [Use zlib]) 680 ], [ 681 AC_SEARCH_LIBS(deflate, z, 682 [with_zlib=yes; AC_DEFINE([WITH_ZLIB], [1], [Use zlib])], 683 [with_zlib=no; AC_MSG_WARN(*** ZLIB was not found. You will not be able to use gzip (de)compression)]) 684 ]) 685]) 686AM_CONDITIONAL([WITH_ZLIB], [test "$with_zlib" = "yes"]) 687 688AC_ARG_WITH(lzma, AS_HELP_STRING([--without-lzma], [disable LZMA compression support]), with_lzma=$withval, with_lzma=yes) 689AS_IF([test "$with_lzma" != "no"], [ 690 PKG_CHECK_MODULES([LZMA], liblzma, [ 691 with_lzma=yes 692 LIBS="$LZMA_LIBS $LIBS" 693 CFLAGS="$LZMA_CFLAGS $CFLAGS" 694 AC_DEFINE([WITH_LZMA], [1], [Use liblzma]) 695 ], [ 696 AC_SEARCH_LIBS(lzma_code, lzma, 697 [with_lzma=yes; AC_DEFINE([WITH_LZMA], [1], [Use liblzma])], 698 [with_lzma=no; AC_MSG_WARN(*** liblzma was not found. You will not be able to use LZMA (de)compression)]) 699 ]) 700]) 701AM_CONDITIONAL([WITH_LZMA], [test "$with_lzma" = "yes"]) 702 703AC_ARG_WITH(brotlidec, AS_HELP_STRING([--without-brotlidec], [disable Brotli compression support]), with_brotlidec=$withval, with_brotlidec=yes) 704AS_IF([test "$with_brotlidec" != "no"], [ 705 PKG_CHECK_MODULES([BROTLIDEC], libbrotlidec, [ 706 with_brotlidec=yes 707 LIBS="$BROTLIDEC_LIBS $LIBS" 708 CFLAGS="$BROTLIDEC_CFLAGS $CFLAGS" 709 AC_DEFINE([WITH_BROTLIDEC], [1], [Use brotlidec]) 710 ], [ 711 AC_SEARCH_LIBS(BrotliDecoderCreateInstance, brotlidec, 712 [with_brotlidec=yes; AC_DEFINE([WITH_BROTLIDEC], [1], [Use libbrotlidec])], 713 [with_brotlidec=no; AC_MSG_WARN(*** libbrotlidec was not found. You will not be able to use Brotli decompression)]) 714 ]) 715]) 716AM_CONDITIONAL([WITH_BROTLIDEC], [test "$with_brotlidec" = "yes"]) 717 718AC_ARG_WITH(zstd, AS_HELP_STRING([--without-zstd], [disable Zstandard compression support]), with_zstd=$withval, with_zstd=yes) 719AS_IF([test "$with_zstd" != "no"], [ 720 PKG_CHECK_MODULES([ZSTD], libzstd, [ 721 with_zstd=yes 722 LIBS="$ZSTD_LIBS $LIBS" 723 CFLAGS="$ZSTD_CFLAGS $CFLAGS" 724 AC_DEFINE([WITH_ZSTD], [1], [Use zstd]) 725 ], [ 726 AC_SEARCH_LIBS(ZSTD_decompressStream, zstd, 727 [with_zstd=yes; AC_DEFINE([WITH_ZSTD], [1], [Use libzstd])], 728 [with_zstd=no; AC_MSG_WARN(*** libzstd was not found. You will not be able to use Zstandard decompression)]) 729 ]) 730]) 731AM_CONDITIONAL([WITH_ZSTD], [test "$with_zstd" = "yes"]) 732 733AC_ARG_WITH(lz, AS_HELP_STRING([--without-lzip], [disable lzip compression support]), with_lzip=$withval, with_lzip=yes) 734AS_IF([test "$with_lzip" != "no"], [ 735 PKG_CHECK_MODULES([LZIP], liblz, [ 736 with_lz=yes 737 LIBS="$LZIP_LIBS $LIBS" 738 CFLAGS="$LZIP_CFLAGS $CFLAGS" 739 AC_DEFINE([WITH_LZIP], [1], [Use liblz (lzip)]) 740 ], [ 741 old_LIBS="$LIBS" 742 LIBS= 743 AC_SEARCH_LIBS(LZ_decompress_open, lz, 744 [with_lzip=yes; LZIP_LIBS="$LIBS"; AC_DEFINE([WITH_LZIP], [1], [Use liblz (lzip)])], 745 [with_lzip=no; AC_MSG_WARN(*** liblz was not found. You will not be able to use lzip decompression)]) 746 LIBS="$old_LIBS $LZIP_LIBS" 747 ]) 748]) 749AM_CONDITIONAL([WITH_LZIP], [test "$with_lzip" = "yes"]) 750 751# Support for internationalized domain names. 752# IDN support in Wget2 is provided in multiple ways: 753# 1. libidn2 >= 0.14.0 (IDNA 2008) 754# 3. libidn (IDNA 2003) 755# 756# If libidn2 is not found at all, we try to fallback to libidn. 757AC_ARG_WITH(libidn2, AS_HELP_STRING([--without-libidn2], [disable IDN2 support]), with_libidn2=$withval, with_libidn2=yes) 758AS_IF([test "$with_libidn2" != "no"], [ 759 PKG_CHECK_MODULES([LIBIDN2], [libidn2 >= 0.14.0], [ 760 with_libidn2=yes 761 IDNA_INFO="IDNA 2008 (libidn2)" 762 LIBS="$LIBIDN2_LIBS $LIBS" 763 CFLAGS="$LIBIDN2_CFLAGS $CFLAGS" 764 AC_DEFINE([WITH_LIBIDN2], [1], [Use libidn2]) 765 ], [ 766 with_libidn2=no 767 AC_MSG_WARN(*** LIBIDN2 was not found. You will not be able to use IDN2008 support) 768 ]) 769]) 770 771AM_CONDITIONAL([WITH_LIBIDN2], [test "$with_libidn2" = "yes"]) 772 773AS_IF([test "$with_libidn2" != "yes"], [ 774 AC_ARG_WITH(libidn, AS_HELP_STRING([--without-libidn], [disable IDN support]), with_libidn=$withval, with_libidn=yes) 775 AS_IF([test "$with_libidn" != "no"], [ 776 PKG_CHECK_MODULES([LIBIDN], libidn, [ 777 with_libidn=yes 778 LIBS="$LIBIDN_LIBS $LIBS" 779 CFLAGS="$LIBIDN_CFLAGS $CFLAGS" 780 AC_DEFINE([WITH_LIBIDN], [1], [Use libidn]) 781 IDNA_INFO="IDNA 2003 (libidn)" 782 ], [ 783 AC_SEARCH_LIBS(idna_to_ascii_8z, idn, 784 [with_libidn=yes; AC_DEFINE([WITH_LIBIDN], [1], [Use libidn]) IDNA_INFO="IDNA 2003 (libidn)"], 785 [with_libidn=no; AC_MSG_WARN(*** LIBIDN was not found. You will not be able to use IDN support)]) 786 ]) 787 ]) 788]) 789AM_CONDITIONAL([WITH_LIBIDN], [test "$with_libidn" = "yes"]) 790 791AC_ARG_WITH(libpcre2, AS_HELP_STRING([--without-libpcre2], [disable support for libpcre2]), with_libpcre2=$withval, with_libpcre2=yes) 792AS_IF([test "$with_libpcre2" != "no"], [ 793 PKG_CHECK_MODULES([LIBPCRE2], libpcre2-8, [ 794 with_libpcre2=yes 795 LIBS="$LIBPCRE2_LIBS $LIBS" 796 CFLAGS="$LIBPCRE2_CFLAGS $CFLAGS" 797 AC_DEFINE([WITH_LIBPCRE2], [1], [PCRE regex support enabled via libpcre2]) 798 ], [ 799 AC_SEARCH_LIBS(pcre2_compile_8, pcre2-8, 800 [with_libpcre2=yes; AC_DEFINE([WITH_LIBPCRE2], [1], [PCRE regex support enabled via libpcre2])], 801 [with_libpcre2=no; AC_MSG_WARN(*** libpcre2 was not found. PCRE2 regex support disabled.)]) 802 ]) 803]) 804AM_CONDITIONAL([WITH_LIBPCRE2], [test "$with_libpcre2" = "yes"]) 805 806AS_IF([test "$with_libpcre2" != "yes"], [ 807 AC_ARG_WITH(libpcre, AS_HELP_STRING([--without-libpcre], [disable support for libpcre]), with_libpcre=$withval, with_libpcre=yes) 808 AS_IF([test "$with_libpcre" != "no"], [ 809 PKG_CHECK_MODULES([LIBPCRE], libpcre, [ 810 with_libpcre=yes 811 LIBS="$LIBPCRE_LIBS $LIBS" 812 CFLAGS="$LIBPCRE_CFLAGS $CFLAGS" 813 AC_DEFINE([WITH_LIBPCRE], [1], [PCRE regex support enabled via libpcre]) 814 ], [ 815 AC_SEARCH_LIBS(pcre_compile, pcre, 816 [with_libpcre=yes; AC_DEFINE([WITH_LIBPCRE], [1], [PCRE regex support enabled via libpcre])], 817 [with_libpcre=no; AC_MSG_WARN(*** libpcre was not found. PCRE regex support disabled.)]) 818 ]) 819 ]) 820]) 821AM_CONDITIONAL([WITH_LIBPCRE], [test "$with_libpcre" = "yes"]) 822 823AS_IF([test "$with_libpcre" = "yes"], [HAVE_PCRE="yes, via libpcre"], [test "$with_libpcre2" = "yes"], [HAVE_PCRE="yes, via libpcre2"], [HAVE_PCRE=no]) 824 825AC_ARG_WITH(libmicrohttpd, AS_HELP_STRING([--without-libmicrohttpd], [disable support for libmicrohttpd]), with_libmicrohttpd=$withval, with_libmicrohttpd=yes) 826AS_IF([test "$with_libmicrohttpd" != "no"], [ 827 old_LIBS=$LIBS 828 old_CFLAGS=$CFLAGS 829 PKG_CHECK_MODULES(MICROHTTPD, [libmicrohttpd], [ 830 with_libmicrohttpd=yes 831 TEST_LIBS="$MICROHTTPD_LIBS $TEST_LIBS" 832 TEST_CFLAGS="$MICROHTTPD_CFLAGS $TEST_CFLAGS" 833 AC_DEFINE([WITH_MICROHTTPD], [1], [Use Libmicrohttpd]) 834 LIBS="$MICROHTTPD_LIBS $LIBS" 835 CFLAGS="$MICROHTTPD_CFLAGS $CFLAGS" 836 AC_CHECK_FUNCS(MHD_free) 837 AC_CHECK_HEADERS([microhttpd_http2.h]) 838 LIBS=$old_LIBS 839 CFLAGS=$old_CFLAGS 840 ], [ 841 AC_SEARCH_LIBS(MHD_start_daemon, microhttpd, 842 [with_libmicrohttpd=yes; AC_DEFINE([WITH_MICROHTTPD], [1], [Use libmicrohttpd])], 843 [with_libmicrohttpd=no; AC_MSG_WARN(*** LIBMICROHTTPD was not found. Several tests will not run.)]) 844 AC_CHECK_FUNCS(MHD_free) 845 AC_CHECK_HEADERS([microhttpd_http2.h]) 846 TEST_LIBS=$LIBS 847 TEST_CFLAGS=$CFLAGS 848 ]) 849 LIBS=$old_LIBS 850 CFLAGS=$old_CFLAGS 851 852 AS_IF([test "$with_libmicrohttpd" = "yes" && test "$with_gnutls" != "yes"], [ 853 dnl MHD needs GnuTLS 854 PKG_CHECK_MODULES([GNUTLS], [gnutls], [ 855 TEST_LIBS="$TEST_LIBS $GNUTLS_LIBS" 856 TEST_CFLAGS="$TEST_CFLAGS $GNUTLS_CFLAGS" 857 AC_DEFINE([WITH_GNUTLS_IN_TESTSUITE], [1], [GnuTLS is available for test suite.]) 858 AC_CHECK_HEADERS([gnutls/ocsp.h], 859 [AC_DEFINE([WITH_GNUTLS_OCSP], [1], [GnuTLS OCSP is supported for test suite.])], 860 [AC_MSG_WARN(*** Header file gnutls/ocsp.h was not found. OCSP will be disabled for tests.)]) 861 ], [ 862 old_LIBS=$LIBS 863 old_CFLAGS=$CFLAGS 864 AC_SEARCH_LIBS(gnutls_global_init, gnutls, 865 [AC_DEFINE([WITH_GNUTLS_IN_TESTSUITE], [1], [GnuTLS is available for test suite.])], 866 [AC_MSG_WARN(*** GnuTLS is not available. Some tests will not run.)]) 867 TEST_LIBS=$LIBS 868 TEST_CFLAGS=$CFLAGS 869 LIBS=$old_LIBS 870 CFLAGS=$old_CFLAGS 871 ]) 872 ]) 873]) 874 875AM_CONDITIONAL([WITH_MICROHTTPD], [test "$with_libmicrohttpd" = "yes"]) 876 877# Check for plugin support 878AC_CANONICAL_HOST 879case "$host_os" in 880 mingw*) 881 dl_impl="windows"; 882 ;; 883 win32*) 884 dl_impl="windows"; 885 ;; 886 *) 887 dl_impl="libdl"; 888 ;; 889esac 890AC_ARG_WITH(plugin_support, 891 AS_HELP_STRING([--without-plugin-support], 892 [Disable plugin support]), 893 [plugin_support="$withval"], 894 [plugin_support="yes"]) 895FUZZ_LIBS=$LIBS 896if test "$plugin_support" = "no"; then 897 OLD_LIBS=$LIBS 898 AC_SEARCH_LIBS([dlsym], [dl dld]) 899 FUZZ_LIBS=$LIBS 900 LIBS=$OLD_LIBS 901elif test "$dl_impl" = "libdl"; then 902 AC_SEARCH_LIBS([dlsym], [dl ldl], [:], [dl_impl="none"]) 903 FUZZ_LIBS=$LIBS 904fi 905AC_SUBST([FUZZ_LIBS]) 906if test "$plugin_support" = "yes" && test "$dl_impl" = "none"; then 907 AC_MSG_WARN(*** No working backend for plugin support found) 908 plugin_support="no" 909fi 910if test "$plugin_support" = "yes"; then 911 AC_DEFINE([PLUGIN_SUPPORT], [1], [Enable plugin support]) 912 if test "$dl_impl" = "windows"; then 913 AC_DEFINE([PLUGIN_SUPPORT_WINDOWS], [1], [Use windows API for plugins]) 914 else 915 AC_DEFINE([PLUGIN_SUPPORT_LIBDL], [1], [Use libdl for plugins]) 916 fi 917fi 918AM_CONDITIONAL([PLUGIN_SUPPORT], [test "$plugin_support" = "yes"]) 919 920AC_SUBST([TEST_CFLAGS]) 921AC_SUBST([TEST_LIBS]) 922AC_SUBST([ALL_LIBS], $LIBS) 923 924# Checks for header files. 925AC_CHECK_HEADERS([\ 926 crypt.h idna.h idn/idna.h idn2.h unicase.h netinet/tcp.h]) 927 928# Checks for library functions. 929AC_FUNC_FORK 930AC_FUNC_MMAP 931AC_CHECK_FUNCS([\ 932 strlcpy getuid fmemopen]) 933 934AC_CONFIG_FILES([Makefile 935 lib/Makefile 936 include/Makefile 937 include/wget/Makefile 938 libwget/Makefile 939 src/Makefile 940 examples/Makefile 941 unit-tests/Makefile 942 tests/Makefile 943 fuzz/Makefile 944 libwget.pc 945 docs/Makefile 946 docs/libwget.doxy 947 docs/wget2_md2man.sh]) 948AC_OUTPUT 949 950# patching libtool, generated when coming here 951patch libtool contrib/libtool.patch 952 953AC_MSG_NOTICE([Summary of build options: 954 955 Version: ${PACKAGE_VERSION} 956 Host OS: ${host_os} 957 Install prefix: ${prefix} 958 Compiler: ${CC} 959 CFlags: ${CFLAGS} ${CPPFLAGS} ${WARN_CFLAGS} 960 LDFlags: ${LDFLAGS} 961 Libs: ${LIBS} 962 Library types: shared=${enable_shared}, static=${enable_static} 963 Small libraries: $enable_manylibs 964 SSL/TLS support: $ssl_enabled 965 GZIP compression: $with_zlib 966 BZIP2 compression: $with_bzip2 967 LZMA compression: $with_lzma 968 Brotli compression: $with_brotlidec 969 Zstd compression: $with_zstd 970 Lzip compression: $with_lzip 971 IDNA support: $IDNA_INFO 972 PSL support: $with_libpsl 973 HSTS support: $with_libhsts 974 HTTP/2.0 support: $with_libnghttp2 975 Documentation: $DOCS_INFO 976 Wget2 docs: $WGET2_DOCS_INFO 977 Libwget docs: $LIBWGET_DOCS_INFO 978 PCRE support: ${HAVE_PCRE} 979 Tests: ${TESTS_INFO} 980 Assertions: $ENABLE_ASSERT 981 POSIX xattr: $ENABLE_XATTR 982 Microhttpd support: $with_libmicrohttpd (CFLAGS: ${TEST_CFLAGS}. LIBS: ${TEST_LIBS}) 983 Fuzzing build: $enable_fuzzing, $LIB_FUZZING_ENGINE 984 GPGME: $with_gpgme 985]) 986