dep-curl/acinclude.m4

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1531 lines
42 KiB
Text
Raw Permalink Normal View History

2005-12-20 09:02:36 +00:00
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
2005-12-20 09:02:36 +00:00
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
2020-11-04 14:02:01 +01:00
# are also available at https://curl.se/docs/copyright.html.
2005-12-20 09:02:36 +00:00
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
2008-07-26 12:11:22 +00:00
#***************************************************************************
2008-08-01 06:21:34 +00:00
dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
dnl -------------------------------------------------
dnl Use the C preprocessor to find out if the given object-style symbol
dnl is defined and get its expansion. This macro does not use default
dnl includes even if no INCLUDES argument is given. This macro runs
dnl silently when invoked with three arguments. If the expansion would
dnl result in a set of double-quoted strings the returned expansion is
dnl actually a single double-quoted string concatenating all them.
AC_DEFUN([CURL_CHECK_DEF], [
AC_REQUIRE([CURL_CPP_P])
OLDCPPFLAGS=$CPPFLAGS
dnl CPPPFLAG comes from CURL_CPP_P
CPPFLAGS="$CPPFLAGS $CPPPFLAG"
AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])
AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])
2008-07-27 21:47:22 +00:00
if test -z "$SED"; then
AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
fi
if test -z "$GREP"; then
AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
fi
ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
tmp_exp=""
AC_PREPROC_IFELSE([
AC_LANG_SOURCE(
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
ifelse($2,,,[$2])[[
#ifdef $1
CURL_DEF_TOKEN $1
#endif
]])
],[
tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
"$GREP" CURL_DEF_TOKEN 2>/dev/null | \
"$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
"$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
2008-08-09 17:26:24 +00:00
if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
tmp_exp=""
fi
])
if test -z "$tmp_exp"; then
2008-08-08 16:25:07 +00:00
AS_VAR_SET(ac_HaveDef, no)
ifelse($3,,[AC_MSG_RESULT([no])])
else
2008-08-08 16:25:07 +00:00
AS_VAR_SET(ac_HaveDef, yes)
AS_VAR_SET(ac_Def, $tmp_exp)
ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
fi
AS_VAR_POPDEF([ac_Def])
AS_VAR_POPDEF([ac_HaveDef])
CPPFLAGS=$OLDCPPFLAGS
])
dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
dnl -------------------------------------------------
dnl Use the C compiler to find out only if the given symbol is defined
dnl or not, this can not find out its expansion. This macro does not use
dnl default includes even if no INCLUDES argument is given. This macro
dnl runs silently when invoked with three arguments.
AC_DEFUN([CURL_CHECK_DEF_CC], [
AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])
ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
AC_COMPILE_IFELSE([
AC_LANG_SOURCE(
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
ifelse($2,,,[$2])[[
int main(void)
{
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
#ifndef $1
#error force compilation error
#endif
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
return 0;
}
]])
],[
tst_symbol_defined="yes"
],[
tst_symbol_defined="no"
])
if test "$tst_symbol_defined" = "yes"; then
AS_VAR_SET(ac_HaveDef, yes)
ifelse($3,,[AC_MSG_RESULT([yes])])
else
AS_VAR_SET(ac_HaveDef, no)
ifelse($3,,[AC_MSG_RESULT([no])])
fi
AS_VAR_POPDEF([ac_HaveDef])
])
dnl CURL_CHECK_LIB_XNET
dnl -------------------------------------------------
dnl Verify if X/Open network library is required.
AC_DEFUN([CURL_CHECK_LIB_XNET], [
AC_MSG_CHECKING([if X/Open network library is required])
tst_lib_xnet_required="no"
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([[
int main(void)
{
#if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
#elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
#else
#error force compilation error
#endif
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
return 0;
}
]])
],[
tst_lib_xnet_required="yes"
LIBS="-lxnet $LIBS"
])
AC_MSG_RESULT([$tst_lib_xnet_required])
])
dnl CURL_CHECK_AIX_ALL_SOURCE
dnl -------------------------------------------------
dnl Provides a replacement of traditional AC_AIX with
dnl an uniform behavior across all autoconf versions,
dnl and with our own placement rules.
AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
AH_VERBATIM([_ALL_SOURCE],
[/* Define to 1 if OS is AIX. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif])
AC_BEFORE([$0], [AC_SYS_LARGEFILE])
AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])
AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
AC_EGREP_CPP([yes_this_is_aix],[
#ifdef _AIX
yes_this_is_aix
#endif
],[
AC_MSG_RESULT([yes])
AC_DEFINE(_ALL_SOURCE)
],[
AC_MSG_RESULT([no])
])
])
dnl CURL_CHECK_NATIVE_WINDOWS
dnl -------------------------------------------------
dnl Check if building a native Windows target
AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
]],[[
#ifdef _WIN32
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
int dummy = 1;
(void)dummy;
#else
#error Not a native Windows build target.
#endif
]])
],[
curl_cv_native_windows="yes"
],[
curl_cv_native_windows="no"
])
])
AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "$curl_cv_native_windows" = "yes")
])
dnl CURL_CHECK_HEADER_LBER
dnl -------------------------------------------------
dnl Check for compilable and valid lber.h header,
dnl and check if it is needed even with ldap.h
AC_DEFUN([CURL_CHECK_HEADER_LBER], [
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#endif
#ifndef NULL
#define NULL (void *)0
#endif
#include <lber.h>
]],[[
BerValue *bvp = NULL;
BerElement *bep = ber_init(bvp);
ber_free(bep, 1);
]])
],[
curl_cv_header_lber_h="yes"
],[
curl_cv_header_lber_h="no"
])
])
if test "$curl_cv_header_lber_h" = "yes"; then
AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
[Define to 1 if you have the lber.h header file.])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#endif
#ifndef NULL
#define NULL (void *)0
#endif
#ifndef LDAP_DEPRECATED
#define LDAP_DEPRECATED 1
#endif
#include <ldap.h>
]],[[
BerValue *bvp = NULL;
BerElement *bep = ber_init(bvp);
ber_free(bep, 1);
]])
],[
curl_cv_need_header_lber_h="no"
],[
curl_cv_need_header_lber_h="yes"
])
case "$curl_cv_need_header_lber_h" in
yes)
AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
[Define to 1 if you need the lber.h header file even with ldap.h])
;;
esac
fi
])
dnl CURL_CHECK_HEADER_LDAP
dnl -------------------------------------------------
dnl Check for compilable and valid ldap.h header
AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
AC_REQUIRE([CURL_CHECK_HEADER_LBER])
AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#endif
#ifndef LDAP_DEPRECATED
#define LDAP_DEPRECATED 1
#endif
#ifdef NEED_LBER_H
#include <lber.h>
#endif
#include <ldap.h>
]],[[
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
int res = ldap_unbind(ldp);
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
(void)res;
]])
],[
curl_cv_header_ldap_h="yes"
],[
curl_cv_header_ldap_h="no"
])
])
case "$curl_cv_header_ldap_h" in
yes)
AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
[Define to 1 if you have the ldap.h header file.])
;;
esac
])
dnl CURL_CHECK_HEADER_LDAP_SSL
dnl -------------------------------------------------
dnl Check for compilable and valid ldap_ssl.h header
AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
AC_REQUIRE([CURL_CHECK_HEADER_LDAP])
AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#endif
#ifndef LDAP_DEPRECATED
#define LDAP_DEPRECATED 1
#endif
#ifdef NEED_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
#include <ldap_ssl.h>
]],[[
LDAP *ldp = ldapssl_init("0.0.0.0", LDAPS_PORT, 1);
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
(void)ldp;
]])
],[
curl_cv_header_ldap_ssl_h="yes"
],[
curl_cv_header_ldap_ssl_h="no"
])
])
case "$curl_cv_header_ldap_ssl_h" in
yes)
AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
[Define to 1 if you have the ldap_ssl.h header file.])
;;
esac
])
dnl CURL_CHECK_LIBS_WINLDAP
dnl -------------------------------------------------
dnl Check for libraries needed for WINLDAP support,
dnl and prepended to LIBS any needed libraries.
dnl This macro can take an optional parameter with a
dnl whitespace separated list of libraries to check
dnl before the WINLDAP default ones.
AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
AC_REQUIRE([CURL_CHECK_HEADER_WINBER])
AC_MSG_CHECKING([for WINLDAP libraries])
u_libs=""
ifelse($1,,,[
for x_lib in $1; do
case "$x_lib" in
-l*)
l_lib="$x_lib"
;;
*)
l_lib="-l$x_lib"
;;
esac
if test -z "$u_libs"; then
u_libs="$l_lib"
else
u_libs="$u_libs $l_lib"
fi
done
])
2007-10-24 16:40:59 +00:00
curl_cv_save_LIBS="$LIBS"
curl_cv_ldap_LIBS="unknown"
for x_nlibs in '' "$u_libs" \
'-lwldap32' ; do
if test "$curl_cv_ldap_LIBS" = "unknown"; then
if test -z "$x_nlibs"; then
LIBS="$curl_cv_save_LIBS"
else
LIBS="$x_nlibs $curl_cv_save_LIBS"
fi
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <winldap.h>
#ifdef HAVE_WINBER_H
#include <winber.h>
#endif
#endif
]],[[
BERVAL *bvp = NULL;
BerElement *bep = ber_init(bvp);
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
ULONG res = ldap_unbind(ldp);
ber_free(bep, 1);
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
(void)res;
]])
],[
curl_cv_ldap_LIBS="$x_nlibs"
])
fi
done
2007-10-24 16:40:59 +00:00
LIBS="$curl_cv_save_LIBS"
case X-"$curl_cv_ldap_LIBS" in
X-unknown)
AC_MSG_RESULT([cannot find WINLDAP libraries])
;;
X-)
AC_MSG_RESULT([no additional lib required])
;;
*)
if test -z "$curl_cv_save_LIBS"; then
LIBS="$curl_cv_ldap_LIBS"
else
LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
fi
AC_MSG_RESULT([$curl_cv_ldap_LIBS])
;;
esac
])
2007-10-14 21:25:10 +00:00
dnl CURL_CHECK_LIBS_LDAP
dnl -------------------------------------------------
dnl Check for libraries needed for LDAP support,
dnl and prepended to LIBS any needed libraries.
dnl This macro can take an optional parameter with a
dnl whitespace separated list of libraries to check
dnl before the default ones.
2007-10-14 21:25:10 +00:00
AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
AC_REQUIRE([CURL_CHECK_HEADER_LDAP])
AC_MSG_CHECKING([for LDAP libraries])
u_libs=""
ifelse($1,,,[
for x_lib in $1; do
case "$x_lib" in
-l*)
l_lib="$x_lib"
;;
*)
l_lib="-l$x_lib"
;;
esac
if test -z "$u_libs"; then
u_libs="$l_lib"
else
u_libs="$u_libs $l_lib"
fi
done
])
2007-10-24 16:40:59 +00:00
curl_cv_save_LIBS="$LIBS"
2007-10-14 21:25:10 +00:00
curl_cv_ldap_LIBS="unknown"
for x_nlibs in '' "$u_libs" \
'-lldap' \
'-lldap -llber' \
'-llber -lldap' \
'-lldapssl -lldapx -lldapsdk' \
'-lldapsdk -lldapx -lldapssl' \
'-lldap -llber -lssl -lcrypto'; do
if test "$curl_cv_ldap_LIBS" = "unknown"; then
if test -z "$x_nlibs"; then
LIBS="$curl_cv_save_LIBS"
else
LIBS="$x_nlibs $curl_cv_save_LIBS"
fi
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#endif
#ifndef NULL
#define NULL (void *)0
#endif
#ifndef LDAP_DEPRECATED
#define LDAP_DEPRECATED 1
#endif
#ifdef NEED_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
]],[[
BerValue *bvp = NULL;
BerElement *bep = ber_init(bvp);
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
int res = ldap_unbind(ldp);
ber_free(bep, 1);
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
(void)res;
]])
],[
curl_cv_ldap_LIBS="$x_nlibs"
])
fi
2007-10-14 21:25:10 +00:00
done
2007-10-24 16:40:59 +00:00
LIBS="$curl_cv_save_LIBS"
2007-10-14 21:25:10 +00:00
case X-"$curl_cv_ldap_LIBS" in
X-unknown)
2007-10-14 23:47:15 +00:00
AC_MSG_RESULT([cannot find LDAP libraries])
2007-10-14 21:25:10 +00:00
;;
X-)
AC_MSG_RESULT([no additional lib required])
;;
*)
if test -z "$curl_cv_save_LIBS"; then
LIBS="$curl_cv_ldap_LIBS"
else
LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
fi
dnl FIXME: Enable when ldap was detected via pkg-config
build: omit certain deps from `libcurl.pc` unless found via `pkg-config` The idea of linking dependencies found to `libcurl.pc` turns out not to work in practice in some cases. Specifically: gss, ldap, mbedtls, libmsh3, rustls A `.pc` may not work or be missing for a couple of reasons: - not all build methods generate it: mbedTLS, Rustls - generated file is broken: msh3 Ref: https://github.com/nibanks/msh3/pull/225 - installed package flavour isn't shipping with one: FreeBSD GSS, OmniOS LDAP, macOS LDAP The effect of such issues shall be subtle in theory, because `libcurl.pc` normally lists these dependencies in the `Requires.private` section meant for static linking. But, e.g. `pkg-config --exists` requires these to be present, and builds sometimes use this check regardless of build type. This bug is not present in `pkgconf`; it only checks for them when `--static` is also passed. Fix these by adding affected `.pc` references to `libcurl.pc` only when we detected the dependency via `pkg-config`. There are a few side-effects of this solution: - references are never added for dependencies where curl doesn't implement `pkg-config` detection. These are: - autotools: ldap, mbedtls, msh3 - cmake: ldap (pending #15273) - generated `libcurl.pc` depends on the build-time environment. - generated `libcurl.pc` depends on curl build tool (cmake, autotools). - generated `libcurl.pc` depends on curl build implementation details. Make an exception for GNU GSS, where I blindly guess that `gss.pc` is always available, as no issues were reported. Other, not mentioned, dependencies continue to be added regardless of the detection method. Reported-by: Harmen Stoppels, Thomas, Daniel Engberg, Andy Fiddaman Fixes #15469 Fixes #15507 Fixes #15535 Fixes https://github.com/curl/curl/pull/15163#issuecomment-2473358444 Closes #15573
2024-11-13 14:44:05 +01:00
if false; then
LIBCURL_PC_REQUIRES_PRIVATE="ldap $LIBCURL_PC_REQUIRES_PRIVATE"
fi
2007-10-14 21:25:10 +00:00
AC_MSG_RESULT([$curl_cv_ldap_LIBS])
;;
esac
])
dnl TYPE_SOCKADDR_STORAGE
dnl -------------------------------------------------
2010-02-14 19:40:18 +00:00
dnl Check for struct sockaddr_storage. Most IPv6-enabled
dnl hosts have it, but AIX 4.3 is one known exception.
AC_DEFUN([TYPE_SOCKADDR_STORAGE],
[
AC_CHECK_TYPE([struct sockaddr_storage],
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
[if struct sockaddr_storage is defined]), ,
[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/socket.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#endif
])
])
dnl CURL_CHECK_FUNC_RECV
dnl -------------------------------------------------
2010-02-14 19:40:18 +00:00
dnl Test if the socket recv() function is available,
AC_DEFUN([CURL_CHECK_FUNC_RECV], [
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
AC_CHECK_HEADERS(sys/types.h)
AC_MSG_CHECKING([for recv])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#else
$curl_includes_bsdsocket
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/socket.h>
#endif
]],[[
recv(0, 0, 0, 0);
]])
],[
AC_MSG_RESULT([yes])
curl_cv_recv="yes"
],[
AC_MSG_RESULT([no])
curl_cv_recv="no"
])
if test "$curl_cv_recv" = "yes"; then
AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
[Define to 1 if you have the recv function.])
curl_cv_func_recv="yes"
else
AC_MSG_ERROR([Unable to link function recv])
fi
])
dnl CURL_CHECK_FUNC_SEND
dnl -------------------------------------------------
2010-02-14 19:40:18 +00:00
dnl Test if the socket send() function is available,
AC_DEFUN([CURL_CHECK_FUNC_SEND], [
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
AC_CHECK_HEADERS(sys/types.h)
AC_MSG_CHECKING([for send])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#else
$curl_includes_bsdsocket
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/socket.h>
#endif
]],[[
2025-02-18 02:49:31 +01:00
char s[] = "";
send(0, (void *)s, 0, 0);
]])
],[
AC_MSG_RESULT([yes])
curl_cv_send="yes"
],[
AC_MSG_RESULT([no])
curl_cv_send="no"
])
if test "$curl_cv_send" = "yes"; then
AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
[Define to 1 if you have the send function.])
curl_cv_func_send="yes"
else
AC_MSG_ERROR([Unable to link function send])
fi
])
dnl CURL_CHECK_STRUCT_TIMEVAL
dnl -------------------------------------------------
dnl Check for timeval struct
AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
AC_CHECK_HEADERS(sys/types.h)
AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <time.h>
]],[[
struct timeval ts;
ts.tv_sec = 0;
ts.tv_usec = 0;
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
(void)ts;
]])
],[
curl_cv_struct_timeval="yes"
],[
curl_cv_struct_timeval="no"
])
])
case "$curl_cv_struct_timeval" in
yes)
AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
[Define to 1 if you have the timeval struct.])
;;
esac
])
dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
dnl -------------------------------------------------
dnl Check if monotonic clock_gettime is available.
AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
AC_CHECK_HEADERS(sys/types.h)
AC_MSG_CHECKING([for monotonic clock_gettime])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifndef _WIN32
#include <sys/time.h>
#endif
#include <time.h>
]],[[
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
(void)ts;
]])
],[
AC_MSG_RESULT([yes])
curl_func_clock_gettime="yes"
],[
AC_MSG_RESULT([no])
curl_func_clock_gettime="no"
])
dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
dnl until library linking and runtime checks for clock_gettime succeed.
])
dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC_RAW
dnl -------------------------------------------------
dnl Check if monotonic clock_gettime is available.
AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC_RAW], [
AC_CHECK_HEADERS(sys/types.h)
AC_MSG_CHECKING([for raw monotonic clock_gettime])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifndef _WIN32
#include <sys/time.h>
#endif
#include <time.h>
]],[[
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
(void)ts;
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC_RAW, 1,
[Define to 1 if you have the clock_gettime function and raw monotonic timer.])
],[
AC_MSG_RESULT([no])
])
])
dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
dnl -------------------------------------------------
dnl If monotonic clock_gettime is available then,
dnl check and prepended to LIBS any needed libraries.
AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])
if test "$curl_func_clock_gettime" = "yes"; then
AC_MSG_CHECKING([for clock_gettime in libraries])
curl_cv_save_LIBS="$LIBS"
curl_cv_gclk_LIBS="unknown"
for x_xlibs in '' '-lrt' '-lposix4' ; do
if test "$curl_cv_gclk_LIBS" = "unknown"; then
if test -z "$x_xlibs"; then
LIBS="$curl_cv_save_LIBS"
else
LIBS="$x_xlibs $curl_cv_save_LIBS"
fi
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifndef _WIN32
#include <sys/time.h>
#endif
#include <time.h>
]],[[
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
(void)ts;
]])
],[
curl_cv_gclk_LIBS="$x_xlibs"
])
fi
done
LIBS="$curl_cv_save_LIBS"
case X-"$curl_cv_gclk_LIBS" in
X-unknown)
AC_MSG_RESULT([cannot find clock_gettime])
AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC is not defined])
curl_func_clock_gettime="no"
;;
X-)
AC_MSG_RESULT([no additional lib required])
curl_func_clock_gettime="yes"
;;
*)
if test "$dontwant_rt" = "yes"; then
AC_MSG_WARN([needs -lrt but asked not to use it, HAVE_CLOCK_GETTIME_MONOTONIC is not defined])
curl_func_clock_gettime="no"
else
if test -z "$curl_cv_save_LIBS"; then
LIBS="$curl_cv_gclk_LIBS"
else
LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
fi
AC_MSG_RESULT([$curl_cv_gclk_LIBS])
curl_func_clock_gettime="yes"
fi
;;
esac
dnl only do runtime verification when not cross-compiling
if test "$cross_compiling" != "yes" &&
test "$curl_func_clock_gettime" = "yes"; then
AC_MSG_CHECKING([if monotonic clock_gettime works])
CURL_RUN_IFELSE([
AC_LANG_PROGRAM([[
#include <stdlib.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifndef _WIN32
#include <sys/time.h>
#endif
#include <time.h>
]],[[
struct timespec ts;
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
if(0 == clock_gettime(CLOCK_MONOTONIC, &ts))
return 0;
(void)ts;
return 1;
]])
],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC is not defined])
curl_func_clock_gettime="no"
LIBS="$curl_cv_save_LIBS"
])
fi
case "$curl_func_clock_gettime" in
yes)
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
[Define to 1 if you have the clock_gettime function and monotonic timer.])
;;
esac
fi
])
dnl CURL_CHECK_LIBS_CONNECT
dnl -------------------------------------------------
dnl Verify if network connect function is already available
dnl using current libraries or if another one is required.
AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
AC_REQUIRE([CURL_INCLUDES_WINSOCK2])
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
AC_MSG_CHECKING([for connect in libraries])
tst_connect_save_LIBS="$LIBS"
tst_connect_need_LIBS="unknown"
for tst_lib in '' '-lsocket' ; do
if test "$tst_connect_need_LIBS" = "unknown"; then
LIBS="$tst_lib $tst_connect_save_LIBS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_winsock2
$curl_includes_bsdsocket
#if !defined(_WIN32) && !defined(HAVE_PROTO_BSDSOCKET_H)
int connect(int, void*, int);
#endif
]],[[
if(0 != connect(0, 0, 0))
return 1;
]])
],[
tst_connect_need_LIBS="$tst_lib"
])
fi
done
LIBS="$tst_connect_save_LIBS"
case X-"$tst_connect_need_LIBS" in
X-unknown)
AC_MSG_RESULT([cannot find connect])
AC_MSG_ERROR([cannot find connect function in libraries.])
;;
X-)
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_RESULT([$tst_connect_need_LIBS])
LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
;;
esac
])
dnl CURL_VERIFY_RUNTIMELIBS
dnl -------------------------------------------------
dnl Verify that the shared libs found so far can be used when running
dnl programs, since otherwise the situation creates odd configure errors
dnl that are misleading people.
dnl
dnl Make sure this test is run BEFORE the first test in the script that
dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
dnl macro. It must also run AFTER all lib-checking macros are complete.
AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
dnl this test is of course not sensible if we are cross-compiling!
if test "$cross_compiling" != "yes"; then
dnl run a program to verify that the libs checked for previous to this
dnl point also is available runtime!
AC_MSG_CHECKING([runtime libs availability])
CURL_RUN_IFELSE([
build: fix compiler warnings in feature detections Fix or silence compiler warnings happening in feature detections to reduce log noise. Warnings may also get promoted to errors in certain cases, causing missed detections. It reduces the number of warnings by 4500+ across the linux, linux-old, macos, non-native and windows GHA workflows (~142 jobs). Also move picky warning logic for MSVC/Borland to `CMake/PickyWarnings.cmake. To make them listed in the picky-warnings log output, and to also apply to feature detections to make them compile under the same conditions as source code. The hope is to help catching issues faster. It also improves code quality of feature tests. Fixed/silenced: ``` warning #177: variable "dummy" was declared but never referenced warning #177: variable "flag" was declared but never referenced warning #177: variable "res" was declared but never referenced warning #592: variable "s" is used before its value is set warning #1011: missing return statement at end of non-void function "main" warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0") warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers) warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations] warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] warning: 'b' is used uninitialized [-Wuninitialized] warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] warning: Value stored to 'i' is never read [deadcode.DeadStores] warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: control reaches end of non-void function [-Wreturn-type] warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] warning: excess elements in struct initializer warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros] warning: macro "_REENTRANT" is not used [-Wunused-macros] warning: missing braces around initializer [-Wmissing-braces] warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations] warning: no previous prototype for 'check' [-Wmissing-prototypes] warning: no previous prototype for function 'check' [-Wmissing-prototypes] warning: null argument where non-null required (argument 2) [-Wnonnull] warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] warning: unused parameter 'c' [-Wunused-parameter] warning: unused parameter 'f' [-Wunused-parameter] warning: unused variable 'data' [-Wunused-variable] warning: unused variable 'dummy' [-Wunused-variable] warning: unused variable 'flag' [-Wunused-variable] warning: unused variable 'res' [-Wunused-variable] warning: unused variable 's' [-Wunused-variable] warning: variable 's' set but not used [-Wunused-but-set-variable] warning: variable 'ts' set but not used [-Wunused-but-set-variable] ``` Closes #16287
2025-02-11 02:46:29 +01:00
int main(void)
{
return 0;
}
],
AC_MSG_RESULT([fine]),
AC_MSG_RESULT([failed])
AC_MSG_ERROR([one or more libs available at link-time are not available runtime. Libs used at link-time: $LIBS])
)
dnl if this test fails, configure has already stopped
fi
])
dnl CURL_CHECK_CA_BUNDLE
dnl -------------------------------------------------
dnl Check if a default ca-bundle should be used
dnl
dnl regarding the paths this scans:
dnl /etc/ssl/certs/ca-certificates.crt Debian systems
dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
dnl /usr/local/share/certs/ca-root-nss.crt MidnightBSD
dnl /etc/ssl/cert.pem OpenBSD, MidnightBSD (symlink)
dnl /etc/ssl/certs (CA path) SUSE, FreeBSD
AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
AC_MSG_CHECKING([default CA cert bundle/path])
AC_ARG_WITH(ca-bundle,
AS_HELP_STRING([--with-ca-bundle=FILE],
[Absolute path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
AS_HELP_STRING([--without-ca-bundle], [Do not use a default CA bundle]),
[
want_ca="$withval"
if test "x$want_ca" = "xyes"; then
AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
fi
],
[ want_ca="unset" ])
AC_ARG_WITH(ca-path,
AS_HELP_STRING([--with-ca-path=DIRECTORY],
[Absolute path to a directory containing CA certificates stored individually, with \
their filenames in a hash format. This option can be used with the OpenSSL, \
GnuTLS, mbedTLS and wolfSSL backends. Refer to OpenSSL c_rehash for details. \
(example: /etc/certificates)])
AS_HELP_STRING([--without-ca-path], [Do not use a default CA path]),
[
want_capath="$withval"
if test "x$want_capath" = "xyes"; then
AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
fi
],
[ want_capath="unset"])
ca_warning=" (warning: certs not found)"
capath_warning=" (warning: certs not found)"
check_capath=""
if test "$APPLE_SECTRUST_ENABLED" = "1"; then
ca_native="Apple SecTrust"
windows: add build option to use the native CA store With the same semantics as Apple SecTrust, in both libcurl and the curl tool, when using non-Schannel TLS backends. In practice it means that it makes TLS work without manually or implicitly configuring a CA bundle `.crt` file, such as `curl-ca-bundle.crt`. To enable: - autotools: `--enable-ca-native` - cmake: `-DCURL_CA_NATIVE=ON` - CPPFLAGS: `-DCURL_CA_NATIVE` When enabled: - enables `CURLSSLOPT_NATIVE_CA` (libcurl) / `--ca-native` and `--proxy-ca-native` (curl tool) options by default. - unsafe search for an on-disk CA bundle gets disabled by default. Equivalent to `--disable-ca-search` with autotools, `-DCURL_DISABLE_CA_SEARCH=ON` with CMake. - build-time detection of CA bundle and CA path gets disabled. As with Apple SecTrust. This was already the default for Windows. - native CA can be disabled at run-time with the `--no-ca-native` and/or `--no-proxy-ca-native` command-line options. Rationale: This build option: - has a repeat and active interest from packagers and users. - helps integrating curl with Windows for those who need this. - it also applies to macOS: #17525 Shipped in curl 8.17.0. - makes it trivial to use custom certs configured on the OS. - frees applications/packagers/users from the task of securely distributing, and keeping up-to-date, a CA bundle. - frees potentially many curl tool from configuring a CA bundle manually to access HTTPS (and other TLS) URLs. This is traditionally difficult on Windows because there is no concept of a universal, protected, non-world-writable, location on the file system to securely store a CA bundle. - allows using modern features regardless of Windows version. Some of these features are not supported with Schannel (e.g. HTTP/3, ECH) on any Windows version. - is necessary for HTTP/3 builds, where bootstrapping a CA bundle is not possible with Schannel, because MultiSSL is not an option, and HTTP/3 is not supported with Schannel. Ref: #16181 (previous attempt) Ref: https://github.com/curl/curl/discussions/9348 Ref: https://github.com/curl/curl/issues/9350 Ref: https://github.com/curl/curl/pull/13111 Ref: https://github.com/microsoft/vcpkg/pull/46459#issuecomment-3162068701 Ref: 22652a5a4cb6a4cc1c0f4ff3ebc4f9768f6663cd #14582 Ref: eefd03c572996e5de4dec4fe295ad6f103e0eefc #18703 Closes #18279
2025-08-14 00:48:00 +02:00
elif test "$ca_native_opt" = "1"; then
ca_native="yes"
else
ca_native="no"
fi
if test "x$want_ca" != "xno" && test "x$want_ca" != "xunset" &&
test "x$want_capath" != "xno" && test "x$want_capath" != "xunset"; then
dnl both given
ca="$want_ca"
capath="$want_capath"
elif test "x$want_ca" != "xno" && test "x$want_ca" != "xunset"; then
dnl --with-ca-bundle given
ca="$want_ca"
capath="no"
elif test "x$want_capath" != "xno" && test "x$want_capath" != "xunset"; then
dnl --with-ca-path given
capath="$want_capath"
ca="no"
elif test "$ca_native" != "no"; then
dnl native CA configured, do not look further
ca="no"
capath="no"
else
dnl First try auto-detecting a CA bundle, then a CA path.
dnl Both auto-detections can be skipped by --without-ca-*
ca="no"
capath="no"
if test "$cross_compiling" != "yes" &&
test "$curl_cv_native_windows" != "yes"; then
dnl NOT cross-compiling and...
dnl neither of the --with-ca-* options are provided
if test "x$want_ca" = "xunset"; then
dnl the path we previously would have installed the curl CA bundle
dnl to, and thus we now check for an already existing cert in that
dnl place in case we find no other
if test "x$prefix" != "xNONE"; then
cac="${prefix}/share/curl/curl-ca-bundle.crt"
else
cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
fi
for a in /etc/ssl/certs/ca-certificates.crt \
/etc/pki/tls/certs/ca-bundle.crt \
/usr/share/ssl/certs/ca-bundle.crt \
/usr/local/share/certs/ca-root-nss.crt \
/etc/ssl/cert.pem \
"$cac"; do
if test -f "$a"; then
ca="$a"
break
fi
done
fi
AC_MSG_NOTICE([want $want_capath CA $ca])
if test "x$want_capath" = "xunset"; then
check_capath="/etc/ssl/certs"
fi
else
dnl no option given and cross-compiling
AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
fi
fi
2010-02-14 19:40:18 +00:00
if test "x$ca" = "xno" || test -f "$ca"; then
ca_warning=""
fi
if test "x$capath" != "xno"; then
check_capath="$capath"
fi
if test -n "$check_capath"; then
for a in "$check_capath"; do
if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then
if test "x$capath" = "xno"; then
capath="$a"
fi
capath_warning=""
break
fi
done
fi
if test "x$capath" = "xno"; then
capath_warning=""
fi
if test "x$ca" != "xno"; then
GHA/configure-vs-cmake: check `libcurl.pc`/`curl-config`, fix issues Add CI checker to compare `libcurl.pc` and `curl-config` files generated by autotools and cmake builds. Fix differences and apply tiny cleanups: - curl-config: use single-quotes for literals. - curl-config: quote all variables. - curl-config: replace double with single quotes in a substituted value that's always literal (`@prefix@`). - libcurl.pc: spelling in `Description:`. - libcurl.pc: avoid substitution in a comment. - cmake: fill `libdir` with `${exec_prefix}` instead of a literal. To sync with './configure'. - configure: fix `CURL_CA_BUNDLE` value to not generate nested quotes in `curl-config`. - configure: add missing `LDFLAGS` to `Libs.private` in `libcurl.pc`. To sync with CMake. - cmake: skip adding `CMAKE_C_IMPLICIT_LINK_LIBRARIES` for MINGW and UNIX. They added these values as seen in CI: MINGW: `-lmingw32 -lgcc -lmoldname -lmingwex -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex` Linux: `-lgcc -lgcc_s -lc -lgcc -lgcc_s` - cmake: delete FIXME about enabling libssh2 by default. `./configure` has special defaults for these packages (called: "off"): brotli, zstd, libpsl, libssh2, libssh, wolfssl, librtmp It looks for them, but only at system locations, which makes them never detected e.g. on macOS. CMake doesn't offer such default mode for now. - GHA/macos: drop now redundant `-DCURL_DISABLE_LDAPS=ON`. - cmake: use `CMAKE_INSTALL_INCLUDEDIR` and `CMAKE_INSTALL_LIBDIR` instead of hardcoded `include`/`lib` when generating `libcurl.pc`. Updates to the GHA workflow: - move autotools out-of-tree and rename cmake out-of-tree directory to `bld_cm` to tell it's cmake. - disable static libcurl for `./configure` to match cmake. - enable `pkg-config` debug output with `./configure`. - dump list of Homebrew packages on macOS. - dump `./configure` detailed logs. - disable zstd and brotli for Linux, to match cmake. There remain differences, mostly due to detection order and method. Also some values are inherently different when using CMake and autotools, such as `--cc`, `--configure`. autotools also generates duplicates for `-lssl` and `-lcrypto`. macOS LDAP wants to link `-lber` while autotools doesn't. Some build defaults are also different in autotools and cmake. These differences are smoothened out for now by the checker script, or via build options. Notice that lib order (a dupes) _can_ be significant in some cases. E.g. the binutils linker is infamous for that on Windows. Closes #14681
2024-08-25 21:40:13 +02:00
CURL_CA_BUNDLE="$ca"
AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default CA bundle])
AC_SUBST(CURL_CA_BUNDLE)
AC_MSG_RESULT([$ca])
fi
if test "x$capath" != "xno"; then
CURL_CA_PATH="\"$capath\""
AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default CA path])
AC_MSG_RESULT([$capath (capath)])
fi
if test "x$ca" = "xno" && test "x$capath" = "xno"; then
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([whether to use OpenSSL's built-in CA store])
AC_ARG_WITH(ca-fallback,
AS_HELP_STRING([--with-ca-fallback], [Use OpenSSL's built-in CA store])
AS_HELP_STRING([--without-ca-fallback], [Do not use OpenSSL's built-in CA store]),
[
if test "x$with_ca_fallback" != "xyes" && test "x$with_ca_fallback" != "xno"; then
AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter])
fi
],
[ with_ca_fallback="no"])
AC_MSG_RESULT([$with_ca_fallback])
if test "x$with_ca_fallback" = "xyes"; then
if test "$OPENSSL_ENABLED" != "1"; then
AC_MSG_ERROR([--with-ca-fallback only works with OpenSSL])
fi
AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use OpenSSL's built-in CA store])
fi
])
2008-08-01 06:21:34 +00:00
dnl CURL_CHECK_CA_EMBED
dnl -------------------------------------------------
dnl Check if a ca-bundle should be embedded
AC_DEFUN([CURL_CHECK_CA_EMBED], [
AC_MSG_CHECKING([CA cert bundle path to embed in the curl tool])
AC_ARG_WITH(ca-embed,
AS_HELP_STRING([--with-ca-embed=FILE],
[Absolute path to a file containing CA certificates to embed in the curl tool (example: /etc/ca-bundle.crt)])
AS_HELP_STRING([--without-ca-embed], [Do not embed a default CA bundle in the curl tool]),
[
want_ca_embed="$withval"
if test "x$want_ca_embed" = "xyes"; then
AC_MSG_ERROR([--with-ca-embed=FILE requires a path to the CA bundle])
fi
],
[ want_ca_embed="unset" ])
CURL_CA_EMBED=''
if test "x$want_ca_embed" != "xno" && test "x$want_ca_embed" != "xunset" && test -f "$want_ca_embed"; then
2025-07-31 16:38:34 +02:00
if test -n "$PERL"; then
CURL_CA_EMBED="$want_ca_embed"
AC_SUBST(CURL_CA_EMBED)
AC_MSG_RESULT([$want_ca_embed])
else
AC_MSG_RESULT([no])
AC_MSG_WARN([perl was not found. Cannot do CA embed.])
2025-07-31 16:38:34 +02:00
fi
else
AC_MSG_RESULT([no])
fi
])
dnl CURL_CHECK_WIN32_CRYPTO
dnl -------------------------------------------------
dnl Check if curl's Win32 crypto lib can be used
AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
AC_MSG_CHECKING([whether build target supports Win32 crypto API])
curl_win32_crypto_api="no"
if test "$curl_cv_native_windows" = "yes" && test "$curl_cv_winuwp" != "yes"; then
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <wincrypt.h>
]],[[
HCRYPTPROV hCryptProv;
if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
CryptReleaseContext(hCryptProv, 0);
}
]])
],[
curl_win32_crypto_api="yes"
])
fi
case "$curl_win32_crypto_api" in
yes)
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(USE_WIN32_CRYPTO, 1,
[Define to 1 if you are building a Windows target with crypto API support.])
build: drop unused feature macros, update exception list - cmp-config.pl: add remaining exceptions. Sort list. - drop unused `HAVE_SYS_WAIT_H`. Follow-up to 50def7c881ba560ab6e0235990e8f07fa69f4bc8 #13249 - drop unused `HAVE_FCHMOD`. Follow-up to 03cb1ff4d629d6110dab787c75c187626d58323d #12395 - autotools: stop promoting variables to macros: `USE_NGTCP2_CRYPTO_*`, `USE_NGTCP2_H3`, `USE_OPENSSL_H3`, `HAVE_LIBRESSL`. They are not used in the source. - cmake: drop unused `HAVE_O_NONBLOCK`, `HAVE_DISABLED_NONBLOCKING`. - lib: drop `NEED_MALLOC_H`. It was used in manual-build cases for Amiga/MS-DOS/Windows/WinCE, but never by autotools/cmake, thus apparently unnecessary. - lib: drop unused `NEED_MEMORY_H`. - lib: simplify classic mac feature guards, drop `HAVE_EXTRA_STRICMP_H` and `HAVE_EXTRA_STRDUP_H`. - autotools: drop unused `HAVE_GETHOSTBYNAME` detection. - autotools: drop unused OpenSSL feature tests: `HAVE_ERR_H`, `HAVE_PEM_H`, `HAVE_RSA_H` - autotools: drop unused OpenSSL feature tests: `HAVE_X509_H`, `HAVE_CRYPTO_H`, `HAVE_SSL_H`. They performed a fallback check when the primary check missed `openssl/x509.h`. Though if any other prefixed headers were found, OpenSSL is already assumed detected. The fallback check was looking for 3 unprefixed OpenSSL headers, and if all found, marked OpenSSL found internally, but did not promote it to `curl_config.h` via `USE_OPENSSL`. Meaning it either didn't do anything or may have continued with an inconsistent state. Added in d99c20f62876457ca6880d706825e68f695bda18 (2008) At the time, there was an extra `AC_DEFINE(USE_SSLEAY, 1 ...` logic after this code, which kicked in in the fallback case, but that code was deleted in 709cf76f6bb7dbaca14e3e8df160ccfac04dcecb (2015) Follow-up to 709cf76f6bb7dbaca14e3e8df160ccfac04dcecb - autotools: drop `AC_SUBST()` where the value is explicitly set anyway and the macro is unused. - autotools: replace `AC_SUBST(VAR, 1)` with local variable assigments, where the `@VAR@` macro is unused. Also dedupe the local variable if there was a parallel one used for the same purpose. - autotools: drop local feature variables that were never used. - autotools: drop unused `CURL_CHECK_OPTION_NTLM_WB`, `CURL_CHECK_NTLM_WB`. Also stop setting unused `NTLM_WB_ENABLED` macro for VMS. Follow-up to 50def7c881ba560ab6e0235990e8f07fa69f4bc8 #13249 - autotools: drop unused `PKGADD_*`. Follow-up to bae0d473f5912d38fc8da1f9850a70b015b53c9e #3331 - autotools: drop unused `CURL_NETWORK_LIBS`. Follow-up to 3af75e18d691af24c4a11ee6cb1441de44b3a836 #14697 Closes #15577
2024-11-13 22:38:58 +01:00
USE_WIN32_CRYPTO=1
;;
*)
AC_MSG_RESULT([no])
;;
esac
])
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
dnl CURL_EXPORT_PCDIR ($pcdir, [$additive])
dnl ------------------------
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export.
dnl if $additive is set, extend PKG_CONFIG_PATH instead, by prepending $pcdir
dnl to it, to ensure that system locations are still checked. This is
dnl necessary for modules that depend on modules residing there
dnl (e.g. gnutls.pc).
dnl
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
dnl we need this macro to limit/expand search locations to/with a custom
dnl configured one.
dnl
AC_DEFUN([CURL_EXPORT_PCDIR], [
if test -n "$1"; then
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
if test -n "$2"; then
dnl honor system locations
PKG_CONFIG_PATH="$1${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH
else
dnl ignore and override system locations
PKG_CONFIG_LIBDIR="$1"
export PKG_CONFIG_LIBDIR
fi
fi
])
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
dnl CURL_TRACE_PCDIR ($module, [$pcdir], [$additive])
configure: add option to trace pkg-config detection details To aid debugging cases when dependency detection acts unexpectedly. Sprung from spending days trying to figure out behavior of ngtcp2 crypto modules and their dependencies. You can enable by setting env `CURL_TRACE_PKG_CONFIG` to a non-empty value. When enabled, details are logged for both successful and unsuccessful detections. Logging of unsuccessful ones is automatically enabled when `CURL_CI` env is set, which is the case for all CI jobs. It works by asking for `--debug` output and grepping for lines that seem useful for this purpose. Output is different for classic pkg-config and pkgconf, and may depending on tool version. Also append `--print-errors` output if any. Examples (with pkgconf): Fail, before: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Fail, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for openssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for openssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for openssl ==== error: Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'libngtcp2_crypto_boringssl', not found ---- end configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Success, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... found configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/awslc/build/lib/pkgconfig for openssl trying path: /home/runner/awslc/build/lib/pkgconfig for libssl trying path: /home/runner/awslc/build/lib/pkgconfig for libcrypto ---- end ``` More examples: https://github.com/curl/curl/pull/20926#issuecomment-4064259935 If there is an externally enablable, built-in feature like this in classic pkg-config or pkgconf, I could not find it. Also: - GHA/http3-linux: set `CURL_TRACE_PKG_CONFIG` to log detection details. H3 builds are prone to hard-to-debug dependency issues. Ref: #20920 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Cherry-picked from #20926 Closes #20931
2026-03-15 15:07:35 +01:00
dnl ------------------------
dnl show pkg-config module lookup details, along with a detailed errors
dnl message in case of failure. Supports both pkg-config and pkgconf.
dnl
AC_DEFUN([CURL_TRACE_PCDIR], [
dnl Example pkgconf line:
dnl libpkgconf/pkg.c:746 [pkgconf_pkg_t *pkgconf_pkg_try_specific_path(pkgconf_client_t *, [...]*)]:
dnl trying path: /usr/local/lib/pkgconfig for libngtcp2_crypto_gnutls
configure: add option to trace pkg-config detection details To aid debugging cases when dependency detection acts unexpectedly. Sprung from spending days trying to figure out behavior of ngtcp2 crypto modules and their dependencies. You can enable by setting env `CURL_TRACE_PKG_CONFIG` to a non-empty value. When enabled, details are logged for both successful and unsuccessful detections. Logging of unsuccessful ones is automatically enabled when `CURL_CI` env is set, which is the case for all CI jobs. It works by asking for `--debug` output and grepping for lines that seem useful for this purpose. Output is different for classic pkg-config and pkgconf, and may depending on tool version. Also append `--print-errors` output if any. Examples (with pkgconf): Fail, before: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Fail, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for openssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for openssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for openssl ==== error: Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'libngtcp2_crypto_boringssl', not found ---- end configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Success, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... found configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/awslc/build/lib/pkgconfig for openssl trying path: /home/runner/awslc/build/lib/pkgconfig for libssl trying path: /home/runner/awslc/build/lib/pkgconfig for libcrypto ---- end ``` More examples: https://github.com/curl/curl/pull/20926#issuecomment-4064259935 If there is an externally enablable, built-in feature like this in classic pkg-config or pkgconf, I could not find it. Also: - GHA/http3-linux: set `CURL_TRACE_PKG_CONFIG` to log detection details. H3 builds are prone to hard-to-debug dependency issues. Ref: #20920 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Cherry-picked from #20926 Closes #20931
2026-03-15 15:07:35 +01:00
dnl Rest of strings are for catching classic pkg-config lines.
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
trc=`CURL_EXPORT_PCDIR([$2], [$3])
if test -n "$PKG_CONFIG_LIBDIR"; then
echo "PKG_CONFIG_LIBDIR: '$PKG_CONFIG_LIBDIR'"
fi
if test -n "$PKG_CONFIG_PATH"; then
echo "PKG_CONFIG_PATH: '$PKG_CONFIG_PATH'"
fi
$PKGCONFIG --exists --debug $1 2>&1 | \
$EGREP '(trying path:|Adding directory|Looking for|Scanning directory|Cannot open directory)' | \
$SED 's/^.*trying path:/trying path:/'`
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
msg=`CURL_EXPORT_PCDIR([$2], [$3])
configure: add option to trace pkg-config detection details To aid debugging cases when dependency detection acts unexpectedly. Sprung from spending days trying to figure out behavior of ngtcp2 crypto modules and their dependencies. You can enable by setting env `CURL_TRACE_PKG_CONFIG` to a non-empty value. When enabled, details are logged for both successful and unsuccessful detections. Logging of unsuccessful ones is automatically enabled when `CURL_CI` env is set, which is the case for all CI jobs. It works by asking for `--debug` output and grepping for lines that seem useful for this purpose. Output is different for classic pkg-config and pkgconf, and may depending on tool version. Also append `--print-errors` output if any. Examples (with pkgconf): Fail, before: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Fail, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for openssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for openssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for openssl ==== error: Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'libngtcp2_crypto_boringssl', not found ---- end configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Success, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... found configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/awslc/build/lib/pkgconfig for openssl trying path: /home/runner/awslc/build/lib/pkgconfig for libssl trying path: /home/runner/awslc/build/lib/pkgconfig for libcrypto ---- end ``` More examples: https://github.com/curl/curl/pull/20926#issuecomment-4064259935 If there is an externally enablable, built-in feature like this in classic pkg-config or pkgconf, I could not find it. Also: - GHA/http3-linux: set `CURL_TRACE_PKG_CONFIG` to log detection details. H3 builds are prone to hard-to-debug dependency issues. Ref: #20920 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Cherry-picked from #20926 Closes #20931
2026-03-15 15:07:35 +01:00
$PKGCONFIG --exists --print-errors $1 2>&1`
if test -n "$msg"; then
trc=`echo "$trc"; echo '==== error:'; echo "$msg"`
fi
AC_MSG_NOTICE([pkg-config --exists $1 trace:
---- begin
${trc}
---- end])
])
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir], [$additive])
dnl ------------------------
dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the
dnl path to it, or 'no' if not found/present.
dnl
dnl If pkg-config is present, check that it has info about the $module or
dnl return "no" anyway!
dnl
dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
dnl
AC_DEFUN([CURL_CHECK_PKGCONFIG], [
if test -n "$PKG_CONFIG"; then
PKGCONFIG="$PKG_CONFIG"
else
AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no],
[$PATH:/usr/bin:/usr/local/bin])
fi
if test "$PKGCONFIG" != "no"; then
AC_MSG_CHECKING([for $1 options with pkg-config])
dnl ask pkg-config about $1
itexists=`CURL_EXPORT_PCDIR([$2], [$3])
$PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
if test -z "$itexists"; then
dnl pkg-config does not have info about the given module! set the
dnl variable to 'no'
AC_MSG_RESULT([no])
configure: add option to trace pkg-config detection details To aid debugging cases when dependency detection acts unexpectedly. Sprung from spending days trying to figure out behavior of ngtcp2 crypto modules and their dependencies. You can enable by setting env `CURL_TRACE_PKG_CONFIG` to a non-empty value. When enabled, details are logged for both successful and unsuccessful detections. Logging of unsuccessful ones is automatically enabled when `CURL_CI` env is set, which is the case for all CI jobs. It works by asking for `--debug` output and grepping for lines that seem useful for this purpose. Output is different for classic pkg-config and pkgconf, and may depending on tool version. Also append `--print-errors` output if any. Examples (with pkgconf): Fail, before: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Fail, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for openssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for openssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for openssl ==== error: Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'libngtcp2_crypto_boringssl', not found ---- end configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Success, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... found configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/awslc/build/lib/pkgconfig for openssl trying path: /home/runner/awslc/build/lib/pkgconfig for libssl trying path: /home/runner/awslc/build/lib/pkgconfig for libcrypto ---- end ``` More examples: https://github.com/curl/curl/pull/20926#issuecomment-4064259935 If there is an externally enablable, built-in feature like this in classic pkg-config or pkgconf, I could not find it. Also: - GHA/http3-linux: set `CURL_TRACE_PKG_CONFIG` to log detection details. H3 builds are prone to hard-to-debug dependency issues. Ref: #20920 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Cherry-picked from #20926 Closes #20931
2026-03-15 15:07:35 +01:00
if test -n "$CURL_TRACE_PKG_CONFIG$CURL_CI"; then
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
CURL_TRACE_PCDIR([$1], [$2], [$3])
configure: add option to trace pkg-config detection details To aid debugging cases when dependency detection acts unexpectedly. Sprung from spending days trying to figure out behavior of ngtcp2 crypto modules and their dependencies. You can enable by setting env `CURL_TRACE_PKG_CONFIG` to a non-empty value. When enabled, details are logged for both successful and unsuccessful detections. Logging of unsuccessful ones is automatically enabled when `CURL_CI` env is set, which is the case for all CI jobs. It works by asking for `--debug` output and grepping for lines that seem useful for this purpose. Output is different for classic pkg-config and pkgconf, and may depending on tool version. Also append `--print-errors` output if any. Examples (with pkgconf): Fail, before: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Fail, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for openssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for openssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for openssl ==== error: Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'libngtcp2_crypto_boringssl', not found ---- end configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Success, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... found configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/awslc/build/lib/pkgconfig for openssl trying path: /home/runner/awslc/build/lib/pkgconfig for libssl trying path: /home/runner/awslc/build/lib/pkgconfig for libcrypto ---- end ``` More examples: https://github.com/curl/curl/pull/20926#issuecomment-4064259935 If there is an externally enablable, built-in feature like this in classic pkg-config or pkgconf, I could not find it. Also: - GHA/http3-linux: set `CURL_TRACE_PKG_CONFIG` to log detection details. H3 builds are prone to hard-to-debug dependency issues. Ref: #20920 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Cherry-picked from #20926 Closes #20931
2026-03-15 15:07:35 +01:00
fi
PKGCONFIG="no"
else
AC_MSG_RESULT([found])
configure: add option to trace pkg-config detection details To aid debugging cases when dependency detection acts unexpectedly. Sprung from spending days trying to figure out behavior of ngtcp2 crypto modules and their dependencies. You can enable by setting env `CURL_TRACE_PKG_CONFIG` to a non-empty value. When enabled, details are logged for both successful and unsuccessful detections. Logging of unsuccessful ones is automatically enabled when `CURL_CI` env is set, which is the case for all CI jobs. It works by asking for `--debug` output and grepping for lines that seem useful for this purpose. Output is different for classic pkg-config and pkgconf, and may depending on tool version. Also append `--print-errors` output if any. Examples (with pkgconf): Fail, before: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Fail, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for openssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for openssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for openssl ==== error: Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'libngtcp2_crypto_boringssl', not found ---- end configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Success, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... found configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/awslc/build/lib/pkgconfig for openssl trying path: /home/runner/awslc/build/lib/pkgconfig for libssl trying path: /home/runner/awslc/build/lib/pkgconfig for libcrypto ---- end ``` More examples: https://github.com/curl/curl/pull/20926#issuecomment-4064259935 If there is an externally enablable, built-in feature like this in classic pkg-config or pkgconf, I could not find it. Also: - GHA/http3-linux: set `CURL_TRACE_PKG_CONFIG` to log detection details. H3 builds are prone to hard-to-debug dependency issues. Ref: #20920 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Cherry-picked from #20926 Closes #20931
2026-03-15 15:07:35 +01:00
if test -n "$CURL_TRACE_PKG_CONFIG"; then
configure: fix `--with-ngtcp2=<path>` option for crypto libs ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files. This broke certain build cases in curl, because configure was is querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the directory specified via `--with-*=` options, including `--with-ngtcp2=`. Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no longer find its indirect dependencies, if those were present at system locations (where they typically are). Another fallout was BoringSSL, because it does not provide `openssl.pc` on its own, and successful detection relied on finding a non-BoringSSL copy, typically at a system location (also fixed in ngtcp2 main branch). Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`. This ensures to pick up any dependent modules from system locations. Note the side-effect is that potentially undesired modules may be detected this way from system locations, i.e. it makes this particular detection less "hermetic" than the rest used in curl configure. (Configurations using a bare `--with-ngtcp2` with no path were not affected, and served as a workaround before this patch. It remains a valid way of configuration after.) Both `pkgconf` and `pkg-config` use this logic to calculate their search directory list: ```pseudo search = {} if PKG_CONFIG_PATH is set search += PKG_CONFIG_PATH endif if PKG_CONFIG_LIBDIR is set (even if empty) search += PKG_CONFIG_LIBDIR else search += built-in-pkg-config-dirs endif ``` Refs: https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`) https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482 https://man.archlinux.org/man/pkgconf.1.en https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234 Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041 Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664 Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Closes #20920
2026-03-13 16:34:57 +01:00
CURL_TRACE_PCDIR([$1], [$2], [$3])
configure: add option to trace pkg-config detection details To aid debugging cases when dependency detection acts unexpectedly. Sprung from spending days trying to figure out behavior of ngtcp2 crypto modules and their dependencies. You can enable by setting env `CURL_TRACE_PKG_CONFIG` to a non-empty value. When enabled, details are logged for both successful and unsuccessful detections. Logging of unsuccessful ones is automatically enabled when `CURL_CI` env is set, which is the case for all CI jobs. It works by asking for `--debug` output and grepping for lines that seem useful for this purpose. Output is different for classic pkg-config and pkgconf, and may depending on tool version. Also append `--print-errors` output if any. Examples (with pkgconf): Fail, before: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Fail, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... no configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for openssl trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for openssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for openssl ==== error: Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'libngtcp2_crypto_boringssl', not found ---- end configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file. ``` Success, after: ``` checking for libngtcp2_crypto_boringssl options with pkg-config... found configure: pkg-config --exists libngtcp2_crypto_boringssl trace: ---- begin trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2 trying path: /home/runner/awslc/build/lib/pkgconfig for openssl trying path: /home/runner/awslc/build/lib/pkgconfig for libssl trying path: /home/runner/awslc/build/lib/pkgconfig for libcrypto ---- end ``` More examples: https://github.com/curl/curl/pull/20926#issuecomment-4064259935 If there is an externally enablable, built-in feature like this in classic pkg-config or pkgconf, I could not find it. Also: - GHA/http3-linux: set `CURL_TRACE_PKG_CONFIG` to log detection details. H3 builds are prone to hard-to-debug dependency issues. Ref: #20920 Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188 Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022 Cherry-picked from #20926 Closes #20931
2026-03-15 15:07:35 +01:00
fi
fi
fi
])
dnl CURL_PREPARE_CONFIGUREHELP_PM
dnl -------------------------------------------------
dnl Prepare test harness configurehelp.pm module, defining and
dnl initializing some perl variables with values which are known
dnl when the configure script runs. For portability reasons, test
dnl harness needs information on how to run the C preprocessor.
AC_DEFUN([CURL_PREPARE_CONFIGUREHELP_PM], [
AC_REQUIRE([AC_PROG_CPP])
tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
if test -z "$tmp_cpp"; then
tmp_cpp='cpp'
fi
AC_SUBST(CURL_CPP, $tmp_cpp)
])
dnl CURL_PREPARE_BUILDINFO
dnl -------------------------------------------------
dnl Save build info for test runner to pick up and log
AC_DEFUN([CURL_PREPARE_BUILDINFO], [
curl_pflags=""
if test "$curl_cv_apple" = "yes"; then
curl_pflags="${curl_pflags} APPLE"
fi
case $host in
*-*-*bsd*|*-*-aix*|*-*-hpux*|*-*-interix*|*-*-irix*|*-*-linux*|*-*-solaris*|*-*-sunos*|*-apple-*|*-*-cygwin*|*-*-msys*)
curl_pflags="${curl_pflags} UNIX";;
esac
case $host in
*-*-*bsd*)
curl_pflags="${curl_pflags} BSD";;
esac
if test "$curl_cv_android" = "yes"; then
curl_pflags="${curl_pflags} ANDROID"
ANDROID_PLATFORM_LEVEL=`echo "$host_os" | $SED -ne 's/.*android\(@<:@0-9@:>@*\).*/\1/p'`
if test -n "${ANDROID_PLATFORM_LEVEL}"; then
curl_pflags="${curl_pflags}-${ANDROID_PLATFORM_LEVEL}"
fi
fi
if test "$curl_cv_native_windows" = "yes"; then
curl_pflags="${curl_pflags} WIN32"
fi
if test "$curl_cv_winuwp" = "yes"; then
curl_pflags="${curl_pflags} UWP"
fi
case $host_os in
cygwin*|msys*) curl_pflags="${curl_pflags} CYGWIN";;
esac
case $host_os in
Makefile.mk: drop in favour of autotools and cmake (MS-DOS, AmigaOS3) `Makefile.mk` supported MS-DOS and Amiga, but `./configure` also supported them in a better tested and more flexible way. This patch also adds CMake support for MS-DOS/DJGPP and Amiga OS 3. `Makefile.mk` was not maintained. Delete it in favour of first-tier build methods. Also include some non-MS-DOS/AmigaOS-specific tidy-up, see details at the end of this message. Details: - fix/silence all MS-DOS/DJGPP build warnings and issues. - add MS-DOS support to cmake. - default to `ENABLE_THREADED_RESOLVER=OFF` for MS-DOS. - add support for `WATT_ROOT`. - use static libcurl with MS-DOS. - fixup default CMake suffixes/prefixes for DJGPP. - disable hidden symbols for MS-DOS. Not supported on MS-DOS. - opt-in MS-DOS into `USE_UNIX_SOCKETS`. - improve MS-DOS support in autotools. - default to `--disable-threaded-resolver` for MS-DOS. - make sure to use `close_s()` (from Watt-32) with autotools and cmake. `Makefile.mk` used it before this patch. - GHA: add DJGPP cmake (~30s) and autotools (~60s) build jobs. Also build tests and examples with cmake. - improve AmigaOS support in autotools: - configure: detect `CloseSocket()` when it's a macro. - configure: fix `IoctlSocket` detection on AmigaOS. - curl-amissl.m4: pass AmiSSL libs to tests/servers. - add AmigaOS3 support to cmake: - cmake: fix `HAVE_IOCTLSOCKET_CAMEL` and `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` detections. - set necessary system libs. - add AmiSSL support. - inet_ntop, inet_pton: fix using it for AmigaOS. cmake detects them, and they did not compile with AmigaOS. - cmake: better sync `gethostname` detection with autotools. Fixes detection for AmigaOS, where `gethostname` is a macro. - cmake: fix `sys/utime.h` detection on AmigaOS. - cmake: force-disable `getaddrinfo` for AmigaOS. - cmake: tweak threading and static/shared default for AmigaOS. - cmake: rely on manual variable `AMIGA` to enable the platform. - GHA: add AmigaOS cmake and autotools (~45s) jobs. Also build tests and examples with cmake. - INSTALL: update MS-DOS and AmigaOS build instructions. - amigaos: fix `-Wpointer-sign` and `zero or negative size array '_args'` in `Printf()`. - amigaos: fix `-Wpointer-sign` - amigaos: fix `-Wredundant-decls` `errno` and `h_errno`. - amigaos: brute-force silence `lseek()` size warnings. - amigaos: server/resolve: silence `-Wdiscarded-qualifiers`. - amigaos: server/resolve: fix `-Wpointer-sign`. - amigaos: fix `CURL_SA_FAMILY_T` type. - nonblock: prefer `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` for AmigaOS. `ioctl` is also detected, but fails when used. Make the above override it for a successful build. Authored-by: Darren Banfi Fixes #15537 Closes #15603 - tftpd: prefer `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` for AmigaOS. - tftpd: tidy-up conditional code. - curl: set stack size to 16384 for AmigaOS3/4 Overriding the default 4096. Suggested-by: Darren Banfi Ref: https://github.com/curl/curl/pull/15543#issuecomment-2498783123 Ref: https://wiki.amigaos.net/wiki/Controlling_Application_Stack - functypes.h: fix `SEND_QUAL_ARG2` for AmigaOS. - tftp: add missing cast in sendto() call for AmigaOS. - getinfo: fix warning with AmigaOS. - tool_operate: silence warning with AmigaOS - amigaos: fix building libtests due to missing `RLIMIT_NOFILE`. - curl_gethostname: silence warning for AmigaOS. - ftp: silence `-Wtype-limits` for AmigaOS. - libtest: fix timeval initialization for AmigaOS. - examples: fix `timeval` initialization for AmigaOS. - examples: silence warning for AmigaOS. - configure: fix IPv6 detection for cross-builds. - netrc: fix to build with AmigaOS cleanly. - buildinfo: detect and add `DOS` tag for MS-DOS builds. - buildinfo: add `AMIGA` to buildinfo.txt in auttools. - build: move `USE_WATT32` macro definition to cmake/configure. Non-MS-DOS/AmigeOS-specific tidy-ups: - configure: sync `sa_family_t` detection with cmake. - configure: sync `ADDRESS_FAMILY` detection signals with cmake. - doh: use `CURL_SA_FAMILY_T`. - lib: drop mingw-specific `CURL_SA_FAMILY_T` workaround. - cmake: extend instead of override check-specific configurations/requirements. This allows to honor global requirements added earlier. Necessary for AmigaOS for example. - cmake: omit warning on disabled IPv6 for MS-DOS and AmigaOS. No IPv6 support on these platforms. Also sync with autotools. - lib1960: use libcurl `inet_pton()` wrapper. - cmake: detect LibreSSL (to match autotools). - cmake: say the specific OpenSSL flavour detected. - hostip: add missing `HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID` guard. - lib: simplify classic mac feature guards. Follow-up to a8861b6ccdd7ca35b6115588a578e36d765c9e38 #9764 Closes #15543
2024-11-16 19:04:36 +01:00
msdos*) curl_pflags="${curl_pflags} DOS";;
amiga*) curl_pflags="${curl_pflags} AMIGA";;
esac
if test "$compiler_id" = "GNU_C"; then
curl_pflags="${curl_pflags} GCC"
fi
if test "$compiler_id" = "APPLECLANG"; then
curl_pflags="${curl_pflags} APPLE-CLANG"
elif test "$compiler_id" = "CLANG"; then
curl_pflags="${curl_pflags} LLVM-CLANG"
fi
case $host_os in
mingw*) curl_pflags="${curl_pflags} MINGW";;
esac
if test "$cross_compiling" = "yes"; then
curl_pflags="${curl_pflags} CROSS"
fi
squeeze curl_pflags
curl_buildinfo="
buildinfo.configure.tool: configure
buildinfo.configure.args: $ac_configure_args
buildinfo.host: $build
buildinfo.host.cpu: $build_cpu
buildinfo.host.os: $build_os
buildinfo.target: $host
buildinfo.target.cpu: $host_cpu
buildinfo.target.os: $host_os
buildinfo.target.flags: $curl_pflags
buildinfo.compiler: $compiler_id
buildinfo.compiler.version: $compiler_ver
buildinfo.sysroot: $lt_sysroot"
])
dnl CURL_CPP_P
dnl
dnl Check if $cpp -P should be used for extract define values due to gcc 5
dnl splitting up strings and defines between line outputs. gcc by default
dnl (without -P) shows TEST EINVAL TEST as
dnl
dnl # 13 "conftest.c"
dnl TEST
dnl # 13 "conftest.c" 3 4
dnl 22
dnl # 13 "conftest.c"
dnl TEST
AC_DEFUN([CURL_CPP_P], [
AC_MSG_CHECKING([if cpp -P is needed])
AC_EGREP_CPP([TEST.*TEST], [
#include <errno.h>
TEST EINVAL TEST
], [cpp=no], [cpp=yes])
AC_MSG_RESULT([$cpp])
dnl we need cpp -P so check if it works then
if test "$cpp" = "yes"; then
AC_MSG_CHECKING([if cpp -P works])
OLDCPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -P"
AC_EGREP_CPP([TEST.*TEST], [
#include <errno.h>
TEST EINVAL TEST
], [cpp_p=yes], [cpp_p=no])
AC_MSG_RESULT([$cpp_p])
if test "$cpp_p" = "no"; then
AC_MSG_WARN([failed to figure out cpp -P alternative])
dnl without -P
CPPPFLAG=""
else
dnl with -P
CPPPFLAG="-P"
fi
dnl restore CPPFLAGS
CPPFLAGS=$OLDCPPFLAGS
else
dnl without -P
CPPPFLAG=""
fi
])
dnl CURL_DARWIN_CFLAGS
dnl
dnl Set -Werror=partial-availability to detect possible breaking code
dnl with low deployment targets.
dnl
AC_DEFUN([CURL_DARWIN_CFLAGS], [
old_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror=partial-availability"
AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
CFLAGS=$old_CFLAGS])
])
dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
dnl
dnl Check to see if the compiler supports __builtin_available. This built-in
dnl compiler function first appeared in Apple LLVM 9.0.0. It is so new that, at
dnl the time this macro was written, the function was not yet documented. Its
dnl purpose is to return true if the code is running under a certain OS version
dnl or later.
AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [
AC_MSG_CHECKING([to see if the compiler supports __builtin_available()])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
]],[[
if(__builtin_available(macOS 10.12, iOS 5.0, *)) {}
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
[Define to 1 if you have the __builtin_available function.])
],[
AC_MSG_RESULT([no])
])
])