2005-12-20 09:02:36 +00:00
|
|
|
#***************************************************************************
|
|
|
|
|
# _ _ ____ _
|
|
|
|
|
# Project ___| | | | _ \| |
|
|
|
|
|
# / __| | | | |_) | |
|
|
|
|
|
# | (__| |_| | _ <| |___
|
|
|
|
|
# \___|\___/|_| \_\_____|
|
|
|
|
|
#
|
2023-01-02 13:51:48 +01:00
|
|
|
# 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
|
2022-05-17 11:16:50 +02:00
|
|
|
#
|
2008-07-26 12:11:22 +00:00
|
|
|
#***************************************************************************
|
2005-12-15 19:39:44 +00:00
|
|
|
|
2008-08-01 06:21:34 +00:00
|
|
|
dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
|
2008-06-20 18:09:48 +00:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
|
dnl Use the C preprocessor to find out if the given object-style symbol
|
2026-05-14 20:37:42 +02:00
|
|
|
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
|
2008-08-07 16:07:26 +00:00
|
|
|
dnl silently when invoked with three arguments. If the expansion would
|
2026-05-14 20:37:42 +02:00
|
|
|
dnl result in a set of double-quoted strings the returned expansion is
|
|
|
|
|
dnl actually a single double-quoted string concatenating all them.
|
2008-06-20 18:09:48 +00:00
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_DEF], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CPP_P])
|
2016-03-18 16:26:05 +01:00
|
|
|
OLDCPPFLAGS=$CPPFLAGS
|
2026-03-19 21:10:39 +01:00
|
|
|
dnl CPPPFLAG comes from CURL_CPP_P
|
2016-08-11 21:37:13 -06:00
|
|
|
CPPFLAGS="$CPPFLAGS $CPPPFLAG"
|
2026-03-19 21:10:39 +01:00
|
|
|
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
|
2008-06-20 18:09:48 +00:00
|
|
|
ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
|
|
|
|
|
tmp_exp=""
|
|
|
|
|
AC_PREPROC_IFELSE([
|
|
|
|
|
AC_LANG_SOURCE(
|
2025-02-11 02:46:29 +01:00
|
|
|
ifelse($2,,,[$2])[[
|
2024-08-28 18:01:27 +02:00
|
|
|
#ifdef $1
|
|
|
|
|
CURL_DEF_TOKEN $1
|
|
|
|
|
#endif
|
2008-06-20 18:09:48 +00:00
|
|
|
]])
|
|
|
|
|
],[
|
|
|
|
|
tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
|
|
|
|
|
"$GREP" CURL_DEF_TOKEN 2>/dev/null | \
|
2011-09-27 21:59:18 +02:00
|
|
|
"$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
|
2008-08-07 16:07:26 +00:00
|
|
|
"$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
|
2008-08-09 17:26:24 +00:00
|
|
|
if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
|
2008-06-20 18:09:48 +00:00
|
|
|
tmp_exp=""
|
|
|
|
|
fi
|
|
|
|
|
])
|
|
|
|
|
if test -z "$tmp_exp"; then
|
2008-08-08 16:25:07 +00:00
|
|
|
AS_VAR_SET(ac_HaveDef, no)
|
2008-06-20 18:09:48 +00:00
|
|
|
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)
|
2008-06-20 18:09:48 +00:00
|
|
|
ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
|
|
|
|
|
fi
|
2026-03-19 21:10:39 +01:00
|
|
|
AS_VAR_POPDEF([ac_Def])
|
|
|
|
|
AS_VAR_POPDEF([ac_HaveDef])
|
2016-03-18 16:26:05 +01:00
|
|
|
CPPFLAGS=$OLDCPPFLAGS
|
2008-06-20 18:09:48 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2009-05-01 02:03:42 +00:00
|
|
|
dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
|
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
|
dnl Use the C compiler to find out only if the given symbol is defined
|
2026-05-14 20:37:42 +02:00
|
|
|
dnl or not, this can not find out its expansion. This macro does not use
|
2009-05-01 02:03:42 +00:00
|
|
|
dnl default includes even if no INCLUDES argument is given. This macro
|
2026-05-14 20:37:42 +02:00
|
|
|
dnl runs silently when invoked with three arguments.
|
2009-05-01 02:03:42 +00:00
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_DEF_CC], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])
|
2009-05-01 02:03:42 +00:00
|
|
|
ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
|
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
|
AC_LANG_SOURCE(
|
2025-02-11 02:46:29 +01:00
|
|
|
ifelse($2,,,[$2])[[
|
2024-08-28 18:01:27 +02:00
|
|
|
int main(void)
|
|
|
|
|
{
|
2025-02-11 02:46:29 +01:00
|
|
|
#ifndef $1
|
2024-08-28 18:01:27 +02:00
|
|
|
#error force compilation error
|
|
|
|
|
#endif
|
2025-02-11 02:46:29 +01:00
|
|
|
return 0;
|
2024-08-28 18:01:27 +02:00
|
|
|
}
|
2009-05-01 02:03:42 +00:00
|
|
|
]])
|
|
|
|
|
],[
|
|
|
|
|
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
|
2026-03-19 21:10:39 +01:00
|
|
|
AS_VAR_POPDEF([ac_HaveDef])
|
2009-05-01 02:03:42 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2009-05-03 17:35:44 +00:00
|
|
|
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([[
|
2024-08-28 18:01:27 +02:00
|
|
|
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
|
2025-02-11 02:46:29 +01:00
|
|
|
return 0;
|
2024-08-28 18:01:27 +02:00
|
|
|
}
|
2009-05-03 17:35:44 +00:00
|
|
|
]])
|
|
|
|
|
],[
|
|
|
|
|
tst_lib_xnet_required="yes"
|
2012-12-03 22:40:26 +01:00
|
|
|
LIBS="-lxnet $LIBS"
|
2009-05-03 17:35:44 +00:00
|
|
|
])
|
|
|
|
|
AC_MSG_RESULT([$tst_lib_xnet_required])
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2008-08-04 06:48:11 +00:00
|
|
|
dnl CURL_CHECK_AIX_ALL_SOURCE
|
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
|
dnl Provides a replacement of traditional AC_AIX with
|
2020-12-31 10:11:49 +01:00
|
|
|
dnl an uniform behavior across all autoconf versions,
|
2008-08-04 06:48:11 +00:00
|
|
|
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])
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_BEFORE([$0], [AC_SYS_LARGEFILE])
|
|
|
|
|
AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])
|
2008-08-04 06:48:11 +00:00
|
|
|
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])
|
|
|
|
|
])
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2008-05-14 16:14:35 +00:00
|
|
|
dnl CURL_CHECK_NATIVE_WINDOWS
|
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
|
dnl Check if building a native Windows target
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
|
2016-04-15 16:37:20 +02:00
|
|
|
AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [
|
2005-12-15 19:39:44 +00:00
|
|
|
AC_COMPILE_IFELSE([
|
2008-05-20 04:23:30 +00:00
|
|
|
AC_LANG_PROGRAM([[
|
|
|
|
|
]],[[
|
2024-08-28 18:01:27 +02:00
|
|
|
#ifdef _WIN32
|
2025-02-11 02:46:29 +01:00
|
|
|
int dummy = 1;
|
|
|
|
|
(void)dummy;
|
2024-08-28 18:01:27 +02:00
|
|
|
#else
|
|
|
|
|
#error Not a native Windows build target.
|
|
|
|
|
#endif
|
2008-05-20 04:23:30 +00:00
|
|
|
]])
|
2005-12-15 19:39:44 +00:00
|
|
|
],[
|
2023-12-09 20:37:11 +00:00
|
|
|
curl_cv_native_windows="yes"
|
2005-12-15 19:39:44 +00:00
|
|
|
],[
|
2023-12-09 20:37:11 +00:00
|
|
|
curl_cv_native_windows="no"
|
2005-12-15 19:39:44 +00:00
|
|
|
])
|
|
|
|
|
])
|
2025-08-05 16:07:21 +02:00
|
|
|
AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "$curl_cv_native_windows" = "yes")
|
2005-12-15 19:39:44 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2007-10-14 02:37:04 +00:00
|
|
|
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], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
|
2016-04-15 16:37:20 +02:00
|
|
|
AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
|
2007-10-14 02:37:04 +00:00
|
|
|
AC_COMPILE_IFELSE([
|
2008-05-20 04:23:30 +00:00
|
|
|
AC_LANG_PROGRAM([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#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>
|
2008-05-20 04:23:30 +00:00
|
|
|
]],[[
|
2007-10-14 02:37:04 +00:00
|
|
|
BerValue *bvp = NULL;
|
|
|
|
|
BerElement *bep = ber_init(bvp);
|
|
|
|
|
ber_free(bep, 1);
|
2008-05-20 04:23:30 +00:00
|
|
|
]])
|
2007-10-14 02:37:04 +00:00
|
|
|
],[
|
2016-04-15 16:37:20 +02:00
|
|
|
curl_cv_header_lber_h="yes"
|
2007-10-14 02:37:04 +00:00
|
|
|
],[
|
2016-04-15 16:37:20 +02:00
|
|
|
curl_cv_header_lber_h="no"
|
2007-10-14 02:37:04 +00:00
|
|
|
])
|
|
|
|
|
])
|
2016-04-15 16:37:20 +02:00
|
|
|
if test "$curl_cv_header_lber_h" = "yes"; then
|
2007-10-14 02:37:04 +00:00
|
|
|
AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
|
|
|
|
|
[Define to 1 if you have the lber.h header file.])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-14 02:37:04 +00:00
|
|
|
AC_COMPILE_IFELSE([
|
2008-05-20 04:23:30 +00:00
|
|
|
AC_LANG_PROGRAM([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#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>
|
2008-05-20 04:23:30 +00:00
|
|
|
]],[[
|
2007-10-14 02:37:04 +00:00
|
|
|
BerValue *bvp = NULL;
|
|
|
|
|
BerElement *bep = ber_init(bvp);
|
|
|
|
|
ber_free(bep, 1);
|
2008-05-20 04:23:30 +00:00
|
|
|
]])
|
2007-10-14 02:37:04 +00:00
|
|
|
],[
|
|
|
|
|
curl_cv_need_header_lber_h="no"
|
|
|
|
|
],[
|
|
|
|
|
curl_cv_need_header_lber_h="yes"
|
|
|
|
|
])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-14 02:37:04 +00:00
|
|
|
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], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_HEADER_LBER])
|
2016-04-15 16:37:20 +02:00
|
|
|
AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [
|
2007-10-14 02:37:04 +00:00
|
|
|
AC_COMPILE_IFELSE([
|
2008-05-20 04:23:30 +00:00
|
|
|
AC_LANG_PROGRAM([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#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>
|
2008-05-20 04:23:30 +00:00
|
|
|
]],[[
|
2023-10-03 18:17:37 +00:00
|
|
|
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
|
2007-10-14 02:37:04 +00:00
|
|
|
int res = ldap_unbind(ldp);
|
2025-02-11 02:46:29 +01:00
|
|
|
(void)res;
|
2008-05-20 04:23:30 +00:00
|
|
|
]])
|
2007-10-14 02:37:04 +00:00
|
|
|
],[
|
2016-04-15 16:37:20 +02:00
|
|
|
curl_cv_header_ldap_h="yes"
|
2007-10-14 02:37:04 +00:00
|
|
|
],[
|
2016-04-15 16:37:20 +02:00
|
|
|
curl_cv_header_ldap_h="no"
|
2007-10-14 02:37:04 +00:00
|
|
|
])
|
|
|
|
|
])
|
2016-04-15 16:37:20 +02:00
|
|
|
case "$curl_cv_header_ldap_h" in
|
2007-10-14 02:37:04 +00:00
|
|
|
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], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_HEADER_LDAP])
|
2016-04-15 16:37:20 +02:00
|
|
|
AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [
|
2007-10-14 02:37:04 +00:00
|
|
|
AC_COMPILE_IFELSE([
|
2008-05-20 04:23:30 +00:00
|
|
|
AC_LANG_PROGRAM([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#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>
|
2008-05-20 04:23:30 +00:00
|
|
|
]],[[
|
2023-10-03 18:17:37 +00:00
|
|
|
LDAP *ldp = ldapssl_init("0.0.0.0", LDAPS_PORT, 1);
|
2025-02-11 02:46:29 +01:00
|
|
|
(void)ldp;
|
2008-05-20 04:23:30 +00:00
|
|
|
]])
|
2007-10-14 02:37:04 +00:00
|
|
|
],[
|
2016-04-15 16:37:20 +02:00
|
|
|
curl_cv_header_ldap_ssl_h="yes"
|
2007-10-14 02:37:04 +00:00
|
|
|
],[
|
2016-04-15 16:37:20 +02:00
|
|
|
curl_cv_header_ldap_ssl_h="no"
|
2007-10-14 02:37:04 +00:00
|
|
|
])
|
|
|
|
|
])
|
2016-04-15 16:37:20 +02:00
|
|
|
case "$curl_cv_header_ldap_ssl_h" in
|
2007-10-14 02:37:04 +00:00
|
|
|
yes)
|
|
|
|
|
AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
|
|
|
|
|
[Define to 1 if you have the ldap_ssl.h header file.])
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2007-10-19 16:15:42 +00:00
|
|
|
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
|
2020-09-30 21:10:14 +02:00
|
|
|
dnl whitespace separated list of libraries to check
|
2007-10-19 16:15:42 +00:00
|
|
|
dnl before the WINLDAP default ones.
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_HEADER_WINBER])
|
|
|
|
|
|
2007-10-19 16:15:42 +00:00
|
|
|
AC_MSG_CHECKING([for WINLDAP libraries])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-19 16:15:42 +00:00
|
|
|
u_libs=""
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-19 16:15:42 +00:00
|
|
|
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
|
|
|
|
|
])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-24 16:40:59 +00:00
|
|
|
curl_cv_save_LIBS="$LIBS"
|
2007-10-19 16:15:42 +00:00
|
|
|
curl_cv_ldap_LIBS="unknown"
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-19 16:15:42 +00:00
|
|
|
for x_nlibs in '' "$u_libs" \
|
|
|
|
|
'-lwldap32' ; do
|
2008-06-18 04:39:29 +00:00
|
|
|
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([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#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
|
2008-06-18 04:39:29 +00:00
|
|
|
]],[[
|
|
|
|
|
BERVAL *bvp = NULL;
|
|
|
|
|
BerElement *bep = ber_init(bvp);
|
2023-10-03 18:17:37 +00:00
|
|
|
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
|
2008-06-18 04:39:29 +00:00
|
|
|
ULONG res = ldap_unbind(ldp);
|
|
|
|
|
ber_free(bep, 1);
|
2025-02-11 02:46:29 +01:00
|
|
|
(void)res;
|
2008-06-18 04:39:29 +00:00
|
|
|
]])
|
|
|
|
|
],[
|
|
|
|
|
curl_cv_ldap_LIBS="$x_nlibs"
|
|
|
|
|
])
|
|
|
|
|
fi
|
2007-10-19 16:15:42 +00:00
|
|
|
done
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-24 16:40:59 +00:00
|
|
|
LIBS="$curl_cv_save_LIBS"
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-19 16:15:42 +00:00
|
|
|
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.
|
2007-10-17 13:08:10 +00:00
|
|
|
dnl This macro can take an optional parameter with a
|
2020-09-30 21:10:14 +02:00
|
|
|
dnl whitespace separated list of libraries to check
|
2007-10-17 13:08:10 +00:00
|
|
|
dnl before the default ones.
|
2007-10-14 21:25:10 +00:00
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_HEADER_LDAP])
|
|
|
|
|
|
2007-10-19 16:15:42 +00:00
|
|
|
AC_MSG_CHECKING([for LDAP libraries])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-17 13:08:10 +00:00
|
|
|
u_libs=""
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-17 18:47:01 +00:00
|
|
|
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
|
|
|
|
|
])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
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"
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-19 16:15:42 +00:00
|
|
|
for x_nlibs in '' "$u_libs" \
|
2007-10-17 13:08:10 +00:00
|
|
|
'-lldap' \
|
|
|
|
|
'-lldap -llber' \
|
2017-07-04 11:33:51 +02:00
|
|
|
'-llber -lldap' \
|
2007-10-17 13:08:10 +00:00
|
|
|
'-lldapssl -lldapx -lldapsdk' \
|
2019-02-21 13:34:49 +00:00
|
|
|
'-lldapsdk -lldapx -lldapssl' \
|
2024-10-05 01:57:33 +02:00
|
|
|
'-lldap -llber -lssl -lcrypto'; do
|
2019-02-21 13:34:49 +00:00
|
|
|
|
2008-06-18 04:39:29 +00:00
|
|
|
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([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#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
|
2008-06-18 04:39:29 +00:00
|
|
|
]],[[
|
|
|
|
|
BerValue *bvp = NULL;
|
|
|
|
|
BerElement *bep = ber_init(bvp);
|
2023-10-03 18:17:37 +00:00
|
|
|
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
|
2008-06-18 04:39:29 +00:00
|
|
|
int res = ldap_unbind(ldp);
|
|
|
|
|
ber_free(bep, 1);
|
2025-02-11 02:46:29 +01:00
|
|
|
(void)res;
|
2008-06-18 04:39:29 +00:00
|
|
|
]])
|
|
|
|
|
],[
|
|
|
|
|
curl_cv_ldap_LIBS="$x_nlibs"
|
|
|
|
|
])
|
|
|
|
|
fi
|
2007-10-14 21:25:10 +00:00
|
|
|
done
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2007-10-24 16:40:59 +00:00
|
|
|
LIBS="$curl_cv_save_LIBS"
|
2026-03-19 21:10:39 +01:00
|
|
|
|
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
|
2026-03-19 21:10:39 +01:00
|
|
|
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
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2006-07-03 15:32:12 +00:00
|
|
|
dnl TYPE_SOCKADDR_STORAGE
|
|
|
|
|
dnl -------------------------------------------------
|
2010-02-14 19:40:18 +00:00
|
|
|
dnl Check for struct sockaddr_storage. Most IPv6-enabled
|
2006-07-03 15:32:12 +00:00
|
|
|
dnl hosts have it, but AIX 4.3 is one known exception.
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([TYPE_SOCKADDR_STORAGE],
|
|
|
|
|
[
|
|
|
|
|
AC_CHECK_TYPE([struct sockaddr_storage],
|
2024-08-21 11:08:54 +02:00
|
|
|
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
|
|
|
|
|
[if struct sockaddr_storage is defined]), ,
|
2006-07-03 15:32:12 +00:00
|
|
|
[
|
2024-08-28 18:01:27 +02:00
|
|
|
#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
|
2006-07-03 15:32:12 +00:00
|
|
|
])
|
|
|
|
|
])
|
|
|
|
|
|
2006-07-04 13:03:32 +00:00
|
|
|
dnl CURL_CHECK_FUNC_RECV
|
|
|
|
|
dnl -------------------------------------------------
|
2010-02-14 19:40:18 +00:00
|
|
|
dnl Test if the socket recv() function is available,
|
2006-07-04 13:03:32 +00:00
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_FUNC_RECV], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
|
|
|
|
|
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
|
2025-06-11 07:32:16 +02:00
|
|
|
AC_CHECK_HEADERS(sys/types.h)
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2006-07-04 13:03:32 +00:00
|
|
|
AC_MSG_CHECKING([for recv])
|
2008-05-20 01:03:45 +00:00
|
|
|
AC_LINK_IFELSE([
|
2008-05-20 04:23:30 +00:00
|
|
|
AC_LANG_PROGRAM([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#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
|
2008-05-20 04:23:30 +00:00
|
|
|
]],[[
|
2006-07-04 13:03:32 +00:00
|
|
|
recv(0, 0, 0, 0);
|
2008-05-20 04:23:30 +00:00
|
|
|
]])
|
2008-05-20 01:03:45 +00:00
|
|
|
],[
|
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
|
curl_cv_recv="yes"
|
|
|
|
|
],[
|
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
|
curl_cv_recv="no"
|
2006-07-04 13:03:32 +00:00
|
|
|
])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2006-07-04 13:03:32 +00:00
|
|
|
if test "$curl_cv_recv" = "yes"; then
|
2024-08-21 11:08:54 +02:00
|
|
|
AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
|
|
|
|
|
[Define to 1 if you have the recv function.])
|
|
|
|
|
curl_cv_func_recv="yes"
|
2006-08-04 00:39:34 +00:00
|
|
|
else
|
|
|
|
|
AC_MSG_ERROR([Unable to link function recv])
|
2006-07-04 13:03:32 +00:00
|
|
|
fi
|
2008-08-01 06:07:43 +00:00
|
|
|
])
|
2006-07-04 13:03:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
dnl CURL_CHECK_FUNC_SEND
|
|
|
|
|
dnl -------------------------------------------------
|
2010-02-14 19:40:18 +00:00
|
|
|
dnl Test if the socket send() function is available,
|
2006-07-04 13:03:32 +00:00
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_FUNC_SEND], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
|
|
|
|
|
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
|
2025-06-11 07:32:16 +02:00
|
|
|
AC_CHECK_HEADERS(sys/types.h)
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2006-07-04 13:03:32 +00:00
|
|
|
AC_MSG_CHECKING([for send])
|
2008-05-20 01:03:45 +00:00
|
|
|
AC_LINK_IFELSE([
|
2008-05-20 04:23:30 +00:00
|
|
|
AC_LANG_PROGRAM([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#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
|
2008-05-20 04:23:30 +00:00
|
|
|
]],[[
|
configure: silence compiler warnings in feature checks, drop duplicates
Silence compiler warnings (200 of them across the main CI workflows):
```
warning #2193: null argument provided for parameter marked with attribute "nonnull"
warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker]
warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker]
warning: argument 1 null where non-null expected [-Wnonnull]
warning: argument 2 null where non-null expected [-Wnonnull]
warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
warning: null argument where non-null required (argument 1) [-Wnonnull]
```
Also drop `if ... can be linked` feature checks that were identical to
`if ... is compilable` checks, for:
`closesocket`, `ioctlsocket`, `socket`, `freeaddrinfo`, `getaddrinfo`,
`gethostname`, `getpeername`, `getsockname`,
`CloseSocket` (AmigaOS), `IoctlSocket` (AmigaOS).
Another option is to really do the link checks. But, if they weren't
missed so far, it seems safer to drop than risk a detection failure,
as was the case with AmigaOS functions while working on this PR.
There remain 22 `-Wnonnull` warnings in `gethostbyname_r()`,
`getpeername()` `getsockname()`. Most of the rest is necessary for
detection, or originate from autotools and CMake detection code
templates. Some still fixable, like duplicate libs.
Follow-up to ca2f49ded03426a246b3db7833592157cdd7f597 #16287
Closes #16377
2025-02-18 02:49:31 +01:00
|
|
|
char s[] = "";
|
|
|
|
|
send(0, (void *)s, 0, 0);
|
2008-05-20 04:23:30 +00:00
|
|
|
]])
|
2008-05-20 01:03:45 +00:00
|
|
|
],[
|
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
|
curl_cv_send="yes"
|
|
|
|
|
],[
|
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
|
curl_cv_send="no"
|
2006-07-04 13:03:32 +00:00
|
|
|
])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2006-07-04 13:03:32 +00:00
|
|
|
if test "$curl_cv_send" = "yes"; then
|
2022-09-26 11:45:18 +02:00
|
|
|
AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
|
|
|
|
|
[Define to 1 if you have the send function.])
|
|
|
|
|
curl_cv_func_send="yes"
|
2006-08-04 00:39:34 +00:00
|
|
|
else
|
|
|
|
|
AC_MSG_ERROR([Unable to link function send])
|
2006-07-04 13:03:32 +00:00
|
|
|
fi
|
2008-08-01 06:07:43 +00:00
|
|
|
])
|
2006-07-04 13:03:32 +00:00
|
|
|
|
2006-07-28 14:19:02 +00:00
|
|
|
|
2006-10-13 01:35:14 +00:00
|
|
|
dnl CURL_CHECK_STRUCT_TIMEVAL
|
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
|
dnl Check for timeval struct
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
|
2025-06-11 07:32:16 +02:00
|
|
|
AC_CHECK_HEADERS(sys/types.h)
|
2016-04-15 16:37:20 +02:00
|
|
|
AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
|
2006-10-13 01:35:14 +00:00
|
|
|
AC_COMPILE_IFELSE([
|
2008-05-20 04:23:30 +00:00
|
|
|
AC_LANG_PROGRAM([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#undef inline
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
#ifndef WIN32_LEAN_AND_MEAN
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
|
#endif
|
|
|
|
|
#include <winsock2.h>
|
2025-06-11 07:32:16 +02:00
|
|
|
#else
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#include <sys/time.h>
|
2024-08-28 18:01:27 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include <time.h>
|
2008-05-20 04:23:30 +00:00
|
|
|
]],[[
|
2006-10-13 01:35:14 +00:00
|
|
|
struct timeval ts;
|
2025-12-07 16:49:55 +01:00
|
|
|
ts.tv_sec = 0;
|
2006-10-13 01:35:14 +00:00
|
|
|
ts.tv_usec = 0;
|
2025-02-11 02:46:29 +01:00
|
|
|
(void)ts;
|
2008-05-20 04:23:30 +00:00
|
|
|
]])
|
2006-10-13 01:35:14 +00:00
|
|
|
],[
|
2016-04-15 16:37:20 +02:00
|
|
|
curl_cv_struct_timeval="yes"
|
2006-10-13 01:35:14 +00:00
|
|
|
],[
|
2016-04-15 16:37:20 +02:00
|
|
|
curl_cv_struct_timeval="no"
|
2006-10-13 01:35:14 +00:00
|
|
|
])
|
|
|
|
|
])
|
2016-04-15 16:37:20 +02:00
|
|
|
case "$curl_cv_struct_timeval" in
|
2006-10-13 01:35:14 +00:00
|
|
|
yes)
|
|
|
|
|
AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
|
|
|
|
|
[Define to 1 if you have the timeval struct.])
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2008-08-01 06:07:43 +00:00
|
|
|
])
|
2006-11-22 18:41:34 +00:00
|
|
|
|
|
|
|
|
|
2008-05-12 02:04:21 +00:00
|
|
|
dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
|
2008-05-10 15:46:08 +00:00
|
|
|
dnl -------------------------------------------------
|
2008-05-12 02:04:21 +00:00
|
|
|
dnl Check if monotonic clock_gettime is available.
|
2008-05-10 15:46:08 +00:00
|
|
|
|
2008-05-12 02:04:21 +00:00
|
|
|
AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
|
2025-06-11 07:32:16 +02:00
|
|
|
AC_CHECK_HEADERS(sys/types.h)
|
2008-07-02 03:04:56 +00:00
|
|
|
AC_MSG_CHECKING([for monotonic clock_gettime])
|
2025-04-03 10:12:53 +02:00
|
|
|
|
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
|
AC_LANG_PROGRAM([[
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#endif
|
2025-06-11 07:32:16 +02:00
|
|
|
#ifndef _WIN32
|
2025-04-03 10:12:53 +02:00
|
|
|
#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"
|
|
|
|
|
])
|
|
|
|
|
|
2008-07-02 03:04:56 +00:00
|
|
|
dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
|
2025-11-17 18:03:22 +01:00
|
|
|
dnl until library linking and runtime checks for clock_gettime succeed.
|
2008-08-01 06:07:43 +00:00
|
|
|
])
|
2008-05-12 02:04:21 +00:00
|
|
|
|
2023-06-09 20:42:51 +02:00
|
|
|
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], [
|
2025-06-11 07:32:16 +02:00
|
|
|
AC_CHECK_HEADERS(sys/types.h)
|
2023-06-09 20:42:51 +02:00
|
|
|
AC_MSG_CHECKING([for raw monotonic clock_gettime])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2025-04-03 10:12:53 +02:00
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
|
AC_LANG_PROGRAM([[
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#endif
|
2025-06-11 07:32:16 +02:00
|
|
|
#ifndef _WIN32
|
2025-04-03 10:12:53 +02:00
|
|
|
#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])
|
|
|
|
|
])
|
2023-06-09 20:42:51 +02:00
|
|
|
])
|
|
|
|
|
|
2008-06-18 04:39:29 +00:00
|
|
|
|
2008-05-12 02:04:21 +00:00
|
|
|
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], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])
|
|
|
|
|
|
2016-04-17 17:01:13 +02:00
|
|
|
if test "$curl_func_clock_gettime" = "yes"; then
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2008-05-12 02:04:21 +00:00
|
|
|
AC_MSG_CHECKING([for clock_gettime in libraries])
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2008-05-12 02:04:21 +00:00
|
|
|
curl_cv_save_LIBS="$LIBS"
|
|
|
|
|
curl_cv_gclk_LIBS="unknown"
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2008-05-12 02:04:21 +00:00
|
|
|
for x_xlibs in '' '-lrt' '-lposix4' ; do
|
2008-06-18 04:39:29 +00:00
|
|
|
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([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#endif
|
2025-06-11 07:32:16 +02:00
|
|
|
#ifndef _WIN32
|
2024-08-28 18:01:27 +02:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include <time.h>
|
2008-06-18 04:39:29 +00:00
|
|
|
]],[[
|
|
|
|
|
struct timespec ts;
|
|
|
|
|
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
|
2025-02-11 02:46:29 +01:00
|
|
|
(void)ts;
|
2008-06-18 04:39:29 +00:00
|
|
|
]])
|
|
|
|
|
],[
|
|
|
|
|
curl_cv_gclk_LIBS="$x_xlibs"
|
|
|
|
|
])
|
|
|
|
|
fi
|
2008-05-12 02:04:21 +00:00
|
|
|
done
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2008-05-12 02:04:21 +00:00
|
|
|
LIBS="$curl_cv_save_LIBS"
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2008-05-12 02:04:21 +00:00
|
|
|
case X-"$curl_cv_gclk_LIBS" in
|
|
|
|
|
X-unknown)
|
|
|
|
|
AC_MSG_RESULT([cannot find clock_gettime])
|
2026-05-14 20:37:42 +02:00
|
|
|
AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC is not defined])
|
2016-04-17 17:01:13 +02:00
|
|
|
curl_func_clock_gettime="no"
|
2008-05-12 02:04:21 +00:00
|
|
|
;;
|
|
|
|
|
X-)
|
|
|
|
|
AC_MSG_RESULT([no additional lib required])
|
2016-04-17 17:01:13 +02:00
|
|
|
curl_func_clock_gettime="yes"
|
2008-05-12 02:04:21 +00:00
|
|
|
;;
|
|
|
|
|
*)
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$dontwant_rt" = "yes"; then
|
2026-05-14 20:37:42 +02:00
|
|
|
AC_MSG_WARN([needs -lrt but asked not to use it, HAVE_CLOCK_GETTIME_MONOTONIC is not defined])
|
2025-04-03 10:12:53 +02:00
|
|
|
curl_func_clock_gettime="no"
|
2008-05-12 02:04:21 +00:00
|
|
|
else
|
2025-04-03 10:12:53 +02:00
|
|
|
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"
|
2008-05-12 02:04:21 +00:00
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2008-06-29 03:19:20 +00:00
|
|
|
dnl only do runtime verification when not cross-compiling
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$cross_compiling" != "yes" &&
|
2026-06-15 14:33:20 +02:00
|
|
|
test "$curl_func_clock_gettime" = "yes"; then
|
2008-06-29 03:19:20 +00:00
|
|
|
AC_MSG_CHECKING([if monotonic clock_gettime works])
|
2018-09-26 14:16:03 +02:00
|
|
|
CURL_RUN_IFELSE([
|
2008-06-29 03:19:20 +00:00
|
|
|
AC_LANG_PROGRAM([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#endif
|
2025-06-11 07:32:16 +02:00
|
|
|
#ifndef _WIN32
|
2024-08-28 18:01:27 +02:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include <time.h>
|
2008-06-29 03:19:20 +00:00
|
|
|
]],[[
|
|
|
|
|
struct timespec ts;
|
2025-02-11 02:46:29 +01:00
|
|
|
if(0 == clock_gettime(CLOCK_MONOTONIC, &ts))
|
|
|
|
|
return 0;
|
|
|
|
|
(void)ts;
|
|
|
|
|
return 1;
|
2008-06-29 03:19:20 +00:00
|
|
|
]])
|
|
|
|
|
],[
|
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
|
],[
|
|
|
|
|
AC_MSG_RESULT([no])
|
2026-05-14 20:37:42 +02:00
|
|
|
AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC is not defined])
|
2016-04-17 17:01:13 +02:00
|
|
|
curl_func_clock_gettime="no"
|
2008-06-29 03:19:20 +00:00
|
|
|
LIBS="$curl_cv_save_LIBS"
|
|
|
|
|
])
|
|
|
|
|
fi
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2016-04-17 17:01:13 +02:00
|
|
|
case "$curl_func_clock_gettime" in
|
2008-05-12 02:04:21 +00:00
|
|
|
yes)
|
|
|
|
|
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
|
|
|
|
|
[Define to 1 if you have the clock_gettime function and monotonic timer.])
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
fi
|
2008-08-01 06:07:43 +00:00
|
|
|
])
|
2008-05-10 15:46:08 +00:00
|
|
|
|
2008-05-19 16:57:56 +00:00
|
|
|
|
2009-06-20 17:24:43 +00:00
|
|
|
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], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_INCLUDES_WINSOCK2])
|
|
|
|
|
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
|
2009-06-20 17:24:43 +00:00
|
|
|
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([[
|
2009-06-21 02:42:34 +00:00
|
|
|
$curl_includes_winsock2
|
2019-03-08 00:06:59 +00:00
|
|
|
$curl_includes_bsdsocket
|
2023-12-09 20:37:11 +00:00
|
|
|
#if !defined(_WIN32) && !defined(HAVE_PROTO_BSDSOCKET_H)
|
2009-06-21 02:42:34 +00:00
|
|
|
int connect(int, void*, int);
|
|
|
|
|
#endif
|
2009-06-20 17:24:43 +00:00
|
|
|
]],[[
|
|
|
|
|
if(0 != connect(0, 0, 0))
|
|
|
|
|
return 1;
|
|
|
|
|
]])
|
|
|
|
|
],[
|
|
|
|
|
tst_connect_need_LIBS="$tst_lib"
|
|
|
|
|
])
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
LIBS="$tst_connect_save_LIBS"
|
2026-03-19 21:10:39 +01:00
|
|
|
|
2009-06-20 17:24:43 +00:00
|
|
|
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
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2006-10-16 08:30:54 +00:00
|
|
|
dnl CURL_VERIFY_RUNTIMELIBS
|
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
|
dnl Verify that the shared libs found so far can be used when running
|
2026-05-14 20:37:42 +02:00
|
|
|
dnl programs, since otherwise the situation creates odd configure errors
|
2006-10-16 08:30:54 +00:00
|
|
|
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!
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$cross_compiling" != "yes"; then
|
2006-10-16 08:30:54 +00:00
|
|
|
|
2026-05-28 23:50:52 +02:00
|
|
|
dnl run a program to verify that the libs checked for previous to this
|
2025-11-17 18:03:22 +01:00
|
|
|
dnl point also is available runtime!
|
|
|
|
|
AC_MSG_CHECKING([runtime libs availability])
|
2018-05-19 11:24:33 +02:00
|
|
|
CURL_RUN_IFELSE([
|
2025-02-11 02:46:29 +01:00
|
|
|
int main(void)
|
2024-08-28 18:01:27 +02:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
],
|
2006-10-16 08:30:54 +00:00
|
|
|
AC_MSG_RESULT([fine]),
|
|
|
|
|
AC_MSG_RESULT([failed])
|
2025-11-17 18:03:22 +01:00
|
|
|
AC_MSG_ERROR([one or more libs available at link-time are not available runtime. Libs used at link-time: $LIBS])
|
2006-10-16 08:30:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
dnl if this test fails, configure has already stopped
|
|
|
|
|
fi
|
|
|
|
|
])
|
2007-03-22 18:25:38 +00:00
|
|
|
|
|
|
|
|
|
2008-02-18 11:35:12 +00:00
|
|
|
dnl CURL_CHECK_CA_BUNDLE
|
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
|
dnl Check if a default ca-bundle should be used
|
|
|
|
|
dnl
|
2026-05-14 20:37:42 +02:00
|
|
|
dnl regarding the paths this scans:
|
2008-02-18 11:35:12 +00:00
|
|
|
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
|
2023-09-29 10:15:08 +02:00
|
|
|
dnl /usr/local/share/certs/ca-root-nss.crt MidnightBSD
|
|
|
|
|
dnl /etc/ssl/cert.pem OpenBSD, MidnightBSD (symlink)
|
2023-09-30 10:55:15 +00:00
|
|
|
dnl /etc/ssl/certs (CA path) SUSE, FreeBSD
|
2008-02-18 11:35:12 +00:00
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
|
|
|
|
|
|
2008-03-20 08:09:23 +00:00
|
|
|
AC_MSG_CHECKING([default CA cert bundle/path])
|
2008-02-18 11:35:12 +00:00
|
|
|
|
|
|
|
|
AC_ARG_WITH(ca-bundle,
|
2021-03-15 17:32:26 +01:00
|
|
|
AS_HELP_STRING([--with-ca-bundle=FILE],
|
2024-09-24 10:48:59 -07:00
|
|
|
[Absolute path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
|
2025-11-17 18:03:22 +01:00
|
|
|
AS_HELP_STRING([--without-ca-bundle], [Do not use a default CA bundle]),
|
2008-02-18 11:35:12 +00:00
|
|
|
[
|
2008-03-20 08:09:23 +00:00
|
|
|
want_ca="$withval"
|
|
|
|
|
if test "x$want_ca" = "xyes"; then
|
|
|
|
|
AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
|
2008-02-18 11:35:12 +00:00
|
|
|
fi
|
2008-03-20 08:09:23 +00:00
|
|
|
],
|
|
|
|
|
[ want_ca="unset" ])
|
|
|
|
|
AC_ARG_WITH(ca-path,
|
2021-03-15 17:32:26 +01:00
|
|
|
AS_HELP_STRING([--with-ca-path=DIRECTORY],
|
2024-09-24 10:48:59 -07:00
|
|
|
[Absolute path to a directory containing CA certificates stored individually, with \
|
2020-03-04 14:50:11 +01:00
|
|
|
their filenames in a hash format. This option can be used with the OpenSSL, \
|
2023-09-29 12:57:32 +02:00
|
|
|
GnuTLS, mbedTLS and wolfSSL backends. Refer to OpenSSL c_rehash for details. \
|
2016-02-25 01:55:38 -05:00
|
|
|
(example: /etc/certificates)])
|
2025-11-17 18:03:22 +01:00
|
|
|
AS_HELP_STRING([--without-ca-path], [Do not use a default CA path]),
|
2008-03-20 08:09:23 +00:00
|
|
|
[
|
|
|
|
|
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"])
|
|
|
|
|
|
2016-02-25 01:55:38 -05:00
|
|
|
ca_warning=" (warning: certs not found)"
|
|
|
|
|
capath_warning=" (warning: certs not found)"
|
|
|
|
|
check_capath=""
|
|
|
|
|
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$APPLE_SECTRUST_ENABLED" = "1"; then
|
2025-09-24 10:19:46 +02:00
|
|
|
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"
|
2025-09-24 10:19:46 +02:00
|
|
|
else
|
|
|
|
|
ca_native="no"
|
|
|
|
|
fi
|
|
|
|
|
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "x$want_ca" != "xno" && test "x$want_ca" != "xunset" &&
|
|
|
|
|
test "x$want_capath" != "xno" && test "x$want_capath" != "xunset"; then
|
2008-03-20 08:09:23 +00:00
|
|
|
dnl both given
|
2015-02-07 22:06:40 +01:00
|
|
|
ca="$want_ca"
|
|
|
|
|
capath="$want_capath"
|
2025-08-05 16:07:21 +02:00
|
|
|
elif test "x$want_ca" != "xno" && test "x$want_ca" != "xunset"; then
|
2008-03-20 08:09:23 +00:00
|
|
|
dnl --with-ca-bundle given
|
|
|
|
|
ca="$want_ca"
|
|
|
|
|
capath="no"
|
2025-08-05 16:07:21 +02:00
|
|
|
elif test "x$want_capath" != "xno" && test "x$want_capath" != "xunset"; then
|
2008-03-20 08:09:23 +00:00
|
|
|
dnl --with-ca-path given
|
|
|
|
|
capath="$want_capath"
|
|
|
|
|
ca="no"
|
2025-12-12 20:51:52 +01:00
|
|
|
elif test "$ca_native" != "no"; then
|
2026-06-22 15:52:23 +02:00
|
|
|
dnl native CA configured, do not look further
|
2025-09-24 10:19:46 +02:00
|
|
|
ca="no"
|
|
|
|
|
capath="no"
|
2013-09-04 00:01:03 +02:00
|
|
|
else
|
2024-07-14 13:43:22 +02:00
|
|
|
dnl First try auto-detecting a CA bundle, then a CA path.
|
|
|
|
|
dnl Both auto-detections can be skipped by --without-ca-*
|
2008-03-20 08:09:23 +00:00
|
|
|
ca="no"
|
|
|
|
|
capath="no"
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$cross_compiling" != "yes" &&
|
|
|
|
|
test "$curl_cv_native_windows" != "yes"; then
|
2013-09-04 00:01:03 +02:00
|
|
|
dnl NOT cross-compiling and...
|
|
|
|
|
dnl neither of the --with-ca-* options are provided
|
|
|
|
|
if test "x$want_ca" = "xunset"; then
|
2024-07-14 13:43:22 +02:00
|
|
|
dnl the path we previously would have installed the curl CA bundle
|
2013-09-04 00:01:03 +02:00
|
|
|
dnl to, and thus we now check for an already existing cert in that
|
|
|
|
|
dnl place in case we find no other
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "x$prefix" != "xNONE"; then
|
2013-09-04 00:01:03 +02:00
|
|
|
cac="${prefix}/share/curl/curl-ca-bundle.crt"
|
|
|
|
|
else
|
|
|
|
|
cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
|
2008-03-20 08:09:23 +00:00
|
|
|
fi
|
2013-09-04 00:01:03 +02:00
|
|
|
|
|
|
|
|
for a in /etc/ssl/certs/ca-certificates.crt \
|
|
|
|
|
/etc/pki/tls/certs/ca-bundle.crt \
|
|
|
|
|
/usr/share/ssl/certs/ca-bundle.crt \
|
2016-06-24 15:17:53 +02:00
|
|
|
/usr/local/share/certs/ca-root-nss.crt \
|
2013-09-04 00:01:03 +02:00
|
|
|
/etc/ssl/cert.pem \
|
|
|
|
|
"$cac"; do
|
|
|
|
|
if test -f "$a"; then
|
|
|
|
|
ca="$a"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
2026-06-22 15:52:23 +02:00
|
|
|
AC_MSG_NOTICE([want $want_capath CA $ca])
|
2023-09-29 12:57:32 +02:00
|
|
|
if test "x$want_capath" = "xunset"; then
|
2024-07-14 13:43:22 +02:00
|
|
|
check_capath="/etc/ssl/certs"
|
2013-09-04 00:01:03 +02:00
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
dnl no option given and cross-compiling
|
|
|
|
|
AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
|
2008-03-20 08:09:23 +00:00
|
|
|
fi
|
|
|
|
|
fi
|
2010-02-14 19:40:18 +00:00
|
|
|
|
2016-02-25 01:55:38 -05:00
|
|
|
if test "x$ca" = "xno" || test -f "$ca"; then
|
|
|
|
|
ca_warning=""
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test "x$capath" != "xno"; then
|
|
|
|
|
check_capath="$capath"
|
|
|
|
|
fi
|
|
|
|
|
|
2025-08-05 16:07:21 +02:00
|
|
|
if test -n "$check_capath"; then
|
2016-02-25 01:55:38 -05:00
|
|
|
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
|
|
|
|
|
|
2008-02-18 11:35:12 +00:00
|
|
|
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"
|
2026-06-22 15:52:23 +02:00
|
|
|
AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default CA bundle])
|
2008-06-13 00:03:12 +00:00
|
|
|
AC_SUBST(CURL_CA_BUNDLE)
|
2008-03-20 08:09:23 +00:00
|
|
|
AC_MSG_RESULT([$ca])
|
2015-02-07 22:06:40 +01:00
|
|
|
fi
|
|
|
|
|
if test "x$capath" != "xno"; then
|
2008-03-20 08:09:23 +00:00
|
|
|
CURL_CA_PATH="\"$capath\""
|
2026-06-22 15:52:23 +02:00
|
|
|
AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default CA path])
|
2008-03-20 08:09:23 +00:00
|
|
|
AC_MSG_RESULT([$capath (capath)])
|
2015-02-07 22:06:40 +01:00
|
|
|
fi
|
2015-04-30 15:52:23 +02:00
|
|
|
if test "x$ca" = "xno" && test "x$capath" = "xno"; then
|
2008-03-20 08:09:23 +00:00
|
|
|
AC_MSG_RESULT([no])
|
2008-02-18 11:35:12 +00:00
|
|
|
fi
|
2015-03-24 13:25:17 +01:00
|
|
|
|
2025-08-22 17:30:36 +02:00
|
|
|
AC_MSG_CHECKING([whether to use OpenSSL's built-in CA store])
|
2015-03-24 13:25:17 +01:00
|
|
|
AC_ARG_WITH(ca-fallback,
|
2025-08-22 17:30:36 +02:00
|
|
|
AS_HELP_STRING([--with-ca-fallback], [Use OpenSSL's built-in CA store])
|
2025-11-17 18:03:22 +01:00
|
|
|
AS_HELP_STRING([--without-ca-fallback], [Do not use OpenSSL's built-in CA store]),
|
2015-03-24 13:25:17 +01:00
|
|
|
[
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "x$with_ca_fallback" != "xyes" && test "x$with_ca_fallback" != "xno"; then
|
2015-03-24 13:25:17 +01:00
|
|
|
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
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$OPENSSL_ENABLED" != "1"; then
|
2025-08-22 17:30:36 +02:00
|
|
|
AC_MSG_ERROR([--with-ca-fallback only works with OpenSSL])
|
2015-03-24 13:25:17 +01:00
|
|
|
fi
|
2025-08-22 17:30:36 +02:00
|
|
|
AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use OpenSSL's built-in CA store])
|
2015-03-24 13:25:17 +01:00
|
|
|
fi
|
2008-02-18 11:35:12 +00:00
|
|
|
])
|
2008-08-01 06:21:34 +00:00
|
|
|
|
2024-06-29 03:30:14 +02:00
|
|
|
|
|
|
|
|
dnl CURL_CHECK_CA_EMBED
|
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
|
dnl Check if a ca-bundle should be embedded
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_CA_EMBED], [
|
|
|
|
|
|
2024-09-24 21:07:30 +02:00
|
|
|
AC_MSG_CHECKING([CA cert bundle path to embed in the curl tool])
|
2024-06-29 03:30:14 +02:00
|
|
|
|
|
|
|
|
AC_ARG_WITH(ca-embed,
|
|
|
|
|
AS_HELP_STRING([--with-ca-embed=FILE],
|
2024-09-24 21:07:30 +02:00
|
|
|
[Absolute path to a file containing CA certificates to embed in the curl tool (example: /etc/ca-bundle.crt)])
|
2025-11-17 18:03:22 +01:00
|
|
|
AS_HELP_STRING([--without-ca-embed], [Do not embed a default CA bundle in the curl tool]),
|
2024-06-29 03:30:14 +02:00
|
|
|
[
|
|
|
|
|
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=''
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "x$want_ca_embed" != "xno" && test "x$want_ca_embed" != "xunset" && test -f "$want_ca_embed"; then
|
build: if no perl, fix to use the pre-built hugehelp, if present
- cmake: Before this patch a missing perl disabled the curl manual.
After this patch, it automatically picks up a pre-built hugehelp,
if present (= when building from a release tarball).
Follow-up to 0035ff45c59437db1a8ffe960b40905c8582b149 #16081
- autotools: Rework behavior when perl is missing. Before this patch
it caused a hard error when docs/manual/ca-embed were enabled.
Of these, docs were enabled by default. After this patch, doc
generation is automatically skipped, with a warning. Manual generation
falls back to using a pre-built hugehelp, or a stub if that's missing.
CA-embed is automatically skipped, with a warning.
Slight difference from cmake: When built with no perl and no pre-built
hugehelp, the manual is enabled, but the content is empty; with cmake
it's disabled proper.
Follow-up to 137aecfbf1e933e7228a4f62cc977eabffb2afbf #13514
Follow-up to 541321507e386744c3ea1200cc83cc98338e27d7 #12857
Also:
- GHA/distcheck: verify if the pre-built hugehelp makes it into curl.
- GHA/distcheck: streamline disabling perl with autotools.
- GHA/distcheck: `--disable-docs` no longer required to build without perl.
Passing it also implicitly disables the curl manual, which is
undesired in these tests.
- cmake: drop redundant `HAVE_MANUAL_TOOLS` interim variable.
- cmake: move two `set()` lines close to their counterparts.
Follow-up to 25119fbaaa76a182d4b08d64853d0a8db9181219 #18104
Closes #18118
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])
|
2026-05-14 20:37:42 +02:00
|
|
|
AC_MSG_WARN([perl was not found. Cannot do CA embed.])
|
build: if no perl, fix to use the pre-built hugehelp, if present
- cmake: Before this patch a missing perl disabled the curl manual.
After this patch, it automatically picks up a pre-built hugehelp,
if present (= when building from a release tarball).
Follow-up to 0035ff45c59437db1a8ffe960b40905c8582b149 #16081
- autotools: Rework behavior when perl is missing. Before this patch
it caused a hard error when docs/manual/ca-embed were enabled.
Of these, docs were enabled by default. After this patch, doc
generation is automatically skipped, with a warning. Manual generation
falls back to using a pre-built hugehelp, or a stub if that's missing.
CA-embed is automatically skipped, with a warning.
Slight difference from cmake: When built with no perl and no pre-built
hugehelp, the manual is enabled, but the content is empty; with cmake
it's disabled proper.
Follow-up to 137aecfbf1e933e7228a4f62cc977eabffb2afbf #13514
Follow-up to 541321507e386744c3ea1200cc83cc98338e27d7 #12857
Also:
- GHA/distcheck: verify if the pre-built hugehelp makes it into curl.
- GHA/distcheck: streamline disabling perl with autotools.
- GHA/distcheck: `--disable-docs` no longer required to build without perl.
Passing it also implicitly disables the curl manual, which is
undesired in these tests.
- cmake: drop redundant `HAVE_MANUAL_TOOLS` interim variable.
- cmake: move two `set()` lines close to their counterparts.
Follow-up to 25119fbaaa76a182d4b08d64853d0a8db9181219 #18104
Closes #18118
2025-07-31 16:38:34 +02:00
|
|
|
fi
|
2024-06-29 03:30:14 +02:00
|
|
|
else
|
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
|
fi
|
|
|
|
|
])
|
|
|
|
|
|
2021-03-06 15:52:09 +01:00
|
|
|
dnl CURL_CHECK_WIN32_CRYPTO
|
|
|
|
|
dnl -------------------------------------------------
|
tidy-up: OS names
Use these words and casing more consistently across text, comments and
one curl tool output:
AIX, ALPN, ANSI, BSD, Cygwin, Darwin, FreeBSD, GitHub, HP-UX, Linux,
macOS, MS-DOS, MSYS, MinGW, NTLM, POSIX, Solaris, UNIX, Unix, Unicode,
WINE, WebDAV, Win32, winbind, WinIDN, Windows, Windows CE, Winsock.
Mostly OS names and a few more.
Also a couple of other minor text fixups.
Closes #14360
2024-08-03 01:09:57 +02:00
|
|
|
dnl Check if curl's Win32 crypto lib can be used
|
2021-03-06 15:52:09 +01:00
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
|
tidy-up: OS names
Use these words and casing more consistently across text, comments and
one curl tool output:
AIX, ALPN, ANSI, BSD, Cygwin, Darwin, FreeBSD, GitHub, HP-UX, Linux,
macOS, MS-DOS, MSYS, MinGW, NTLM, POSIX, Solaris, UNIX, Unix, Unicode,
WINE, WebDAV, Win32, winbind, WinIDN, Windows, Windows CE, Winsock.
Mostly OS names and a few more.
Also a couple of other minor text fixups.
Closes #14360
2024-08-03 01:09:57 +02:00
|
|
|
AC_MSG_CHECKING([whether build target supports Win32 crypto API])
|
2021-03-06 15:52:09 +01:00
|
|
|
curl_win32_crypto_api="no"
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$curl_cv_native_windows" = "yes" && test "$curl_cv_winuwp" != "yes"; then
|
2021-03-06 15:52:09 +01:00
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
|
AC_LANG_PROGRAM([[
|
2024-08-28 18:01:27 +02:00
|
|
|
#undef inline
|
|
|
|
|
#ifndef WIN32_LEAN_AND_MEAN
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
|
#endif
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <wincrypt.h>
|
2021-03-06 15:52:09 +01:00
|
|
|
]],[[
|
|
|
|
|
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
|
2008-08-26 12:54:12 +00:00
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2008-09-03 18:04:47 +00:00
|
|
|
])
|
2009-01-11 23:41:50 +00:00
|
|
|
|
2026-03-13 16:34:57 +01:00
|
|
|
dnl CURL_EXPORT_PCDIR ($pcdir, [$additive])
|
2010-01-14 01:37:55 +00:00
|
|
|
dnl ------------------------
|
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).
|
2010-01-14 01:37:55 +00:00
|
|
|
dnl
|
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.
|
2010-01-14 01:37:55 +00:00
|
|
|
dnl
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_EXPORT_PCDIR], [
|
2024-08-21 11:08:54 +02:00
|
|
|
if test -n "$1"; then
|
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
|
2024-08-21 11:08:54 +02:00
|
|
|
fi
|
2010-01-14 01:37:55 +00:00
|
|
|
])
|
|
|
|
|
|
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:
|
2026-03-24 14:42:39 +01:00
|
|
|
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.
|
2026-03-13 16:34:57 +01:00
|
|
|
trc=`CURL_EXPORT_PCDIR([$2], [$3])
|
2026-03-16 18:20:51 +01:00
|
|
|
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
|
2026-03-24 14:42:39 +01:00
|
|
|
$PKGCONFIG --exists --debug $1 2>&1 | \
|
|
|
|
|
$EGREP '(trying path:|Adding directory|Looking for|Scanning directory|Cannot open directory)' | \
|
|
|
|
|
$SED 's/^.*trying path:/trying path:/'`
|
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])
|
|
|
|
|
])
|
|
|
|
|
|
2026-03-13 16:34:57 +01:00
|
|
|
dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir], [$additive])
|
2009-01-11 23:41:50 +00:00
|
|
|
dnl ------------------------
|
configure: fix cross pkg-config detection
When cross-compiling, CURL_CHECK_PKGCONFIG was checking for the cross
pkg-config using ${host}-pkg-config.
The gold standard for doing this correctly is pkg-config's own macro,
PKG_PROG_PKG_CONFIG. However, on the assumption that you have a good
reason not to use that directly (reduced dependencies for maintainer
builds?), the behaviour of cURL's version should at least match.
PKG_PROG_PKG_CONFIG uses AC_PATH_TOOL, which ultimately ends up trying
${host_alias}-pkg-config; this is not quite the same as what cURL does,
and may differ because ${host} has been run through config.sub. For
instance, when cross-building to the armhf architecture on Ubuntu,
${host_alias} is arm-linux-gnueabihf while ${host} is
arm-unknown-linux-gnueabihf. This may also have been the cause of the
problem reported at http://curl.haxx.se/mail/lib-2012-04/0224.html.
AC_PATH_TOOL is significantly simpler than cURL's current code, and
dates back to well before the current minimum of Autoconf 2.57, so let's
use it instead.
2012-12-07 12:07:54 +01:00
|
|
|
dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the
|
|
|
|
|
dnl path to it, or 'no' if not found/present.
|
2009-01-11 23:41:50 +00:00
|
|
|
dnl
|
2009-09-02 17:48:26 +00:00
|
|
|
dnl If pkg-config is present, check that it has info about the $module or
|
|
|
|
|
dnl return "no" anyway!
|
2009-01-11 23:41:50 +00:00
|
|
|
dnl
|
2010-01-14 01:37:55 +00:00
|
|
|
dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
|
|
|
|
|
dnl
|
2009-01-11 23:41:50 +00:00
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CHECK_PKGCONFIG], [
|
2024-08-21 11:08:54 +02:00
|
|
|
if test -n "$PKG_CONFIG"; then
|
|
|
|
|
PKGCONFIG="$PKG_CONFIG"
|
|
|
|
|
else
|
|
|
|
|
AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no],
|
|
|
|
|
[$PATH:/usr/bin:/usr/local/bin])
|
|
|
|
|
fi
|
2015-10-23 17:17:54 -04:00
|
|
|
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$PKGCONFIG" != "no"; then
|
2024-08-21 11:08:54 +02:00
|
|
|
AC_MSG_CHECKING([for $1 options with pkg-config])
|
|
|
|
|
dnl ask pkg-config about $1
|
2026-03-19 21:10:39 +01:00
|
|
|
itexists=`CURL_EXPORT_PCDIR([$2], [$3])
|
2024-08-21 11:08:54 +02:00
|
|
|
$PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
|
2010-01-14 01:37:55 +00:00
|
|
|
|
2024-08-21 11:08:54 +02:00
|
|
|
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
|
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"
|
2024-08-21 11:08:54 +02:00
|
|
|
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
|
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
|
2009-01-11 23:41:50 +00:00
|
|
|
fi
|
2024-08-21 11:08:54 +02:00
|
|
|
fi
|
2009-01-11 23:41:50 +00:00
|
|
|
])
|
2010-11-25 21:05:20 +01:00
|
|
|
|
|
|
|
|
|
2024-09-07 01:49:40 +02:00
|
|
|
dnl CURL_PREPARE_CONFIGUREHELP_PM
|
2010-11-25 21:05:20 +01:00
|
|
|
dnl -------------------------------------------------
|
2024-09-07 01:49:40 +02:00
|
|
|
dnl Prepare test harness configurehelp.pm module, defining and
|
2010-11-25 21:05:20 +01:00
|
|
|
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.
|
|
|
|
|
|
2024-09-07 01:49:40 +02:00
|
|
|
AC_DEFUN([CURL_PREPARE_CONFIGUREHELP_PM], [
|
2026-03-19 21:10:39 +01:00
|
|
|
AC_REQUIRE([AC_PROG_CPP])
|
2010-11-25 21:05:20 +01:00
|
|
|
tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
|
|
|
|
|
if test -z "$tmp_cpp"; then
|
|
|
|
|
tmp_cpp='cpp'
|
|
|
|
|
fi
|
2024-09-07 01:49:40 +02:00
|
|
|
AC_SUBST(CURL_CPP, $tmp_cpp)
|
2010-11-25 21:05:20 +01:00
|
|
|
])
|
2016-03-18 16:26:05 +01:00
|
|
|
|
2024-09-05 23:23:47 +02:00
|
|
|
|
2024-09-07 02:43:35 +02:00
|
|
|
dnl CURL_PREPARE_BUILDINFO
|
2024-09-05 23:23:47 +02:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
|
dnl Save build info for test runner to pick up and log
|
|
|
|
|
|
2024-09-07 02:43:35 +02:00
|
|
|
AC_DEFUN([CURL_PREPARE_BUILDINFO], [
|
2024-09-05 23:23:47 +02:00
|
|
|
curl_pflags=""
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$curl_cv_apple" = "yes"; then
|
2025-02-15 11:57:55 +01:00
|
|
|
curl_pflags="${curl_pflags} APPLE"
|
|
|
|
|
fi
|
2025-01-17 01:09:48 +01:00
|
|
|
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
|
2026-05-16 23:38:11 +02:00
|
|
|
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
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$curl_cv_native_windows" = "yes"; then
|
2025-01-17 01:09:48 +01:00
|
|
|
curl_pflags="${curl_pflags} WIN32"
|
|
|
|
|
fi
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$curl_cv_winuwp" = "yes"; then
|
2025-01-17 01:09:48 +01:00
|
|
|
curl_pflags="${curl_pflags} UWP"
|
|
|
|
|
fi
|
2026-02-07 17:57:39 +01:00
|
|
|
case $host_os in
|
|
|
|
|
cygwin*|msys*) curl_pflags="${curl_pflags} CYGWIN";;
|
|
|
|
|
esac
|
2024-09-05 23:23:47 +02:00
|
|
|
case $host_os in
|
2024-11-16 19:04:36 +01:00
|
|
|
msdos*) curl_pflags="${curl_pflags} DOS";;
|
|
|
|
|
amiga*) curl_pflags="${curl_pflags} AMIGA";;
|
2024-09-05 23:23:47 +02:00
|
|
|
esac
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$compiler_id" = "GNU_C"; then
|
2024-09-05 23:23:47 +02:00
|
|
|
curl_pflags="${curl_pflags} GCC"
|
|
|
|
|
fi
|
2025-09-21 17:51:34 +02:00
|
|
|
if test "$compiler_id" = "APPLECLANG"; then
|
2025-09-20 19:04:21 +02:00
|
|
|
curl_pflags="${curl_pflags} APPLE-CLANG"
|
|
|
|
|
elif test "$compiler_id" = "CLANG"; then
|
|
|
|
|
curl_pflags="${curl_pflags} LLVM-CLANG"
|
|
|
|
|
fi
|
2024-09-05 23:23:47 +02:00
|
|
|
case $host_os in
|
|
|
|
|
mingw*) curl_pflags="${curl_pflags} MINGW";;
|
|
|
|
|
esac
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$cross_compiling" = "yes"; then
|
2024-09-05 23:23:47 +02:00
|
|
|
curl_pflags="${curl_pflags} CROSS"
|
|
|
|
|
fi
|
|
|
|
|
squeeze curl_pflags
|
2024-09-07 02:43:35 +02:00
|
|
|
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"
|
2024-09-05 23:23:47 +02:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2016-03-18 16:26:05 +01:00
|
|
|
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
|
2026-05-14 20:37:42 +02:00
|
|
|
dnl (without -P) shows TEST EINVAL TEST as
|
2016-03-18 16:26:05 +01:00
|
|
|
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
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$cpp" = "yes"; then
|
2016-03-18 16:26:05 +01:00
|
|
|
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])
|
|
|
|
|
|
2025-08-05 16:07:21 +02:00
|
|
|
if test "$cpp_p" = "no"; then
|
2016-03-18 16:26:05 +01:00
|
|
|
AC_MSG_WARN([failed to figure out cpp -P alternative])
|
2026-03-19 21:10:39 +01:00
|
|
|
dnl without -P
|
2016-08-11 21:37:13 -06:00
|
|
|
CPPPFLAG=""
|
2016-03-18 16:26:05 +01:00
|
|
|
else
|
2026-03-19 21:10:39 +01:00
|
|
|
dnl with -P
|
2016-08-11 21:37:13 -06:00
|
|
|
CPPPFLAG="-P"
|
2016-03-18 16:26:05 +01:00
|
|
|
fi
|
|
|
|
|
dnl restore CPPFLAGS
|
|
|
|
|
CPPFLAGS=$OLDCPPFLAGS
|
2016-08-11 21:37:13 -06:00
|
|
|
else
|
2026-03-19 21:10:39 +01:00
|
|
|
dnl without -P
|
2016-08-11 21:37:13 -06:00
|
|
|
CPPPFLAG=""
|
2016-03-18 16:26:05 +01:00
|
|
|
fi
|
|
|
|
|
])
|
2016-10-19 14:36:32 +02:00
|
|
|
|
|
|
|
|
|
2021-04-03 13:20:33 +03:00
|
|
|
dnl CURL_DARWIN_CFLAGS
|
2016-10-19 14:36:32 +02:00
|
|
|
dnl
|
2021-04-03 13:20:33 +03:00
|
|
|
dnl Set -Werror=partial-availability to detect possible breaking code
|
2025-11-17 18:03:22 +01:00
|
|
|
dnl with low deployment targets.
|
2016-10-19 14:36:32 +02:00
|
|
|
dnl
|
|
|
|
|
|
2021-04-03 13:20:33 +03:00
|
|
|
AC_DEFUN([CURL_DARWIN_CFLAGS], [
|
2025-02-15 11:57:55 +01:00
|
|
|
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])
|
2016-10-19 14:36:32 +02:00
|
|
|
])
|
2017-08-16 12:24:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
|
|
|
|
|
dnl
|
|
|
|
|
dnl Check to see if the compiler supports __builtin_available. This built-in
|
2025-11-17 18:03:22 +01:00
|
|
|
dnl compiler function first appeared in Apple LLVM 9.0.0. It is so new that, at
|
2017-08-16 12:24:39 -05:00
|
|
|
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([[
|
|
|
|
|
]],[[
|
2024-07-06 03:57:51 +02:00
|
|
|
if(__builtin_available(macOS 10.12, iOS 5.0, *)) {}
|
2017-08-16 12:24:39 -05:00
|
|
|
]])
|
|
|
|
|
],[
|
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
|
AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
|
2024-08-21 11:08:54 +02:00
|
|
|
[Define to 1 if you have the __builtin_available function.])
|
2017-08-16 12:24:39 -05:00
|
|
|
],[
|
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
|
])
|
|
|
|
|
])
|