aboutsummaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m4307
1 files changed, 104 insertions, 203 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index e7a36e4bd..feb9e818f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -5,11 +5,11 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
-# are also available at https://curl.haxx.se/docs/copyright.html.
+# are also available at https://curl.se/docs/copyright.html.
#
# 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
@@ -143,7 +143,7 @@ int main (void)
dnl CURL_CHECK_AIX_ALL_SOURCE
dnl -------------------------------------------------
dnl Provides a replacement of traditional AC_AIX with
-dnl an uniform behaviour across all autoconf versions,
+dnl an uniform behavior across all autoconf versions,
dnl and with our own placement rules.
AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
@@ -235,43 +235,6 @@ AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
])
-dnl CURL_CHECK_HEADER_WINSOCK
-dnl -------------------------------------------------
-dnl Check for compilable and valid winsock.h header
-
-AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
- AC_CACHE_CHECK([for winsock.h], [curl_cv_header_winsock_h], [
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#include <winsock.h>
- ]],[[
-#if defined(__CYGWIN__) || defined(__CEGCC__)
- HAVE_WINSOCK_H shall not be defined.
-#else
- int dummy=WSACleanup();
-#endif
- ]])
- ],[
- curl_cv_header_winsock_h="yes"
- ],[
- curl_cv_header_winsock_h="no"
- ])
- ])
- case "$curl_cv_header_winsock_h" in
- yes)
- AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
- [Define to 1 if you have the winsock.h header file.])
- ;;
- esac
-])
-
-
dnl CURL_CHECK_HEADER_WINSOCK2
dnl -------------------------------------------------
dnl Check for compilable and valid winsock2.h header
@@ -347,6 +310,39 @@ AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
])
+dnl CURL_CHECK_HEADER_WINCRYPT
+dnl -------------------------------------------------
+dnl Check for compilable and valid wincrypt.h header
+
+AC_DEFUN([CURL_CHECK_HEADER_WINCRYPT], [
+ AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
+ AC_CACHE_CHECK([for wincrypt.h], [curl_cv_header_wincrypt_h], [
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#include <wincrypt.h>
+ ]],[[
+ int dummy=2*PROV_RSA_FULL;
+ ]])
+ ],[
+ curl_cv_header_wincrypt_h="yes"
+ ],[
+ curl_cv_header_wincrypt_h="no"
+ ])
+ ])
+ case "$curl_cv_header_wincrypt_h" in
+ yes)
+ AC_DEFINE_UNQUOTED(HAVE_WINCRYPT_H, 1,
+ [Define to 1 if you have the wincrypt.h header file.])
+ ;;
+ esac
+])
+
+
dnl CURL_CHECK_HEADER_WINLDAP
dnl -------------------------------------------------
dnl Check for compilable and valid winldap.h header
@@ -1010,7 +1006,6 @@ dnl and RECV_TYPE_ARG4, defining the type of the function
dnl return value in RECV_TYPE_RETV.
AC_DEFUN([CURL_CHECK_FUNC_RECV], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
AC_CHECK_HEADERS(sys/types.h sys/socket.h)
#
@@ -1025,10 +1020,6 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#else
#ifdef HAVE_PROTO_BSDSOCKET_H
@@ -1073,10 +1064,6 @@ struct Library *SocketBase = NULL;
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#define RECVCALLCONV PASCAL
#else
@@ -1154,7 +1141,6 @@ dnl return value in SEND_TYPE_RETV, and also defining the
dnl type qualifier of second argument in SEND_QUAL_ARG2.
AC_DEFUN([CURL_CHECK_FUNC_SEND], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
AC_CHECK_HEADERS(sys/types.h sys/socket.h)
#
@@ -1169,10 +1155,6 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#else
#ifdef HAVE_PROTO_BSDSOCKET_H
@@ -1217,10 +1199,6 @@ struct Library *SocketBase = NULL;
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#define SENDCALLCONV PASCAL
#else
@@ -1335,10 +1313,6 @@ AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#else
#ifdef HAVE_PROTO_BSDSOCKET_H
@@ -1375,10 +1349,8 @@ dnl -------------------------------------------------
dnl Check for timeval struct
AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
- AC_REQUIRE([AC_HEADER_TIME])dnl
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
- AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h)
+ AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h)
AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
@@ -1390,10 +1362,6 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#endif
#ifdef HAVE_SYS_TYPES_H
@@ -1401,14 +1369,8 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <time.h>
#endif
-#else
-#ifdef HAVE_TIME_H
#include <time.h>
-#endif
-#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
@@ -1432,50 +1394,6 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
])
-dnl TYPE_SIG_ATOMIC_T
-dnl -------------------------------------------------
-dnl Check if the sig_atomic_t type is available, and
-dnl verify if it is already defined as volatile.
-
-AC_DEFUN([TYPE_SIG_ATOMIC_T], [
- AC_CHECK_HEADERS(signal.h)
- AC_CHECK_TYPE([sig_atomic_t],[
- AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
- [Define to 1 if sig_atomic_t is an available typedef.])
- ], ,[
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
- ])
- case "$ac_cv_type_sig_atomic_t" in
- yes)
- #
- AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
- ]],[[
- static volatile sig_atomic_t dummy = 0;
- ]])
- ],[
- AC_MSG_RESULT([no])
- curl_cv_sig_atomic_t_volatile="no"
- ],[
- AC_MSG_RESULT([yes])
- curl_cv_sig_atomic_t_volatile="yes"
- ])
- #
- if test "$curl_cv_sig_atomic_t_volatile" = "yes"; then
- AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
- [Define to 1 if sig_atomic_t is already defined as volatile.])
- fi
- ;;
- esac
-])
-
-
dnl TYPE_IN_ADDR_T
dnl -------------------------------------------------
dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
@@ -1499,10 +1417,6 @@ AC_DEFUN([TYPE_IN_ADDR_T], [
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#else
#ifdef HAVE_SYS_TYPES_H
@@ -1545,10 +1459,6 @@ AC_DEFUN([TYPE_IN_ADDR_T], [
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#else
#ifdef HAVE_SYS_TYPES_H
@@ -1573,8 +1483,7 @@ dnl -------------------------------------------------
dnl Check if monotonic clock_gettime is available.
AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
- AC_REQUIRE([AC_HEADER_TIME])dnl
- AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
+ AC_CHECK_HEADERS(sys/types.h sys/time.h)
AC_MSG_CHECKING([for monotonic clock_gettime])
#
if test "x$dontwant_rt" = "xno" ; then
@@ -1585,14 +1494,8 @@ AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <time.h>
#endif
-#else
-#ifdef HAVE_TIME_H
#include <time.h>
-#endif
-#endif
]],[[
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -1639,14 +1542,8 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <time.h>
#endif
-#else
-#ifdef HAVE_TIME_H
#include <time.h>
-#endif
-#endif
]],[[
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -1694,14 +1591,8 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <time.h>
#endif
-#else
-#ifdef HAVE_TIME_H
#include <time.h>
-#endif
-#endif
]],[[
struct timespec ts;
if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
@@ -1860,10 +1751,6 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#endif
#ifdef HAVE_SYS_TYPES_H
@@ -1871,20 +1758,9 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <time.h>
#endif
-#else
-#ifdef HAVE_TIME_H
#include <time.h>
-#endif
-#endif
#ifndef HAVE_WINDOWS_H
-#ifdef HAVE_PROTO_BSDSOCKET_H
-#include <proto/bsdsocket.h>
-struct Library *SocketBase = NULL;
-#define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
-#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#elif defined(HAVE_UNISTD_H)
@@ -1893,6 +1769,11 @@ struct Library *SocketBase = NULL;
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
+#ifdef HAVE_PROTO_BSDSOCKET_H
+#include <proto/bsdsocket.h>
+struct Library *SocketBase = NULL;
+#define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
+#endif
#endif
]],[[
select(0, 0, 0, 0, 0);
@@ -1924,10 +1805,6 @@ struct Library *SocketBase = NULL;
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#endif
#define SELECTCALLCONV PASCAL
#endif
@@ -1936,20 +1813,9 @@ struct Library *SocketBase = NULL;
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <time.h>
#endif
-#else
-#ifdef HAVE_TIME_H
#include <time.h>
-#endif
-#endif
#ifndef HAVE_WINDOWS_H
-#ifdef HAVE_PROTO_BSDSOCKET_H
-#include <proto/bsdsocket.h>
-struct Library *SocketBase = NULL;
-#define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
-#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#elif defined(HAVE_UNISTD_H)
@@ -1958,6 +1824,11 @@ struct Library *SocketBase = NULL;
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
+#ifdef HAVE_PROTO_BSDSOCKET_H
+#include <proto/bsdsocket.h>
+struct Library *SocketBase = NULL;
+#define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
+#endif
#define SELECTCALLCONV
#endif
#ifndef HAVE_STRUCT_TIMEVAL
@@ -2156,8 +2027,8 @@ dnl regarding the paths this will scan:
dnl /etc/ssl/certs/ca-certificates.crt Debian systems
dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
-dnl /usr/local/share/certs/ca-root-nss.crt FreeBSD
-dnl /etc/ssl/cert.pem OpenBSD, FreeBSD (symlink)
+dnl /usr/local/share/certs/ca-root-nss.crt FreeBSD, MidnightBSD
+dnl /etc/ssl/cert.pem OpenBSD, FreeBSD, MidnightBSD (symlink)
dnl /etc/ssl/certs/ (ca path) SUSE
AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
@@ -2165,9 +2036,9 @@ AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
AC_MSG_CHECKING([default CA cert bundle/path])
AC_ARG_WITH(ca-bundle,
-AC_HELP_STRING([--with-ca-bundle=FILE],
+AS_HELP_STRING([--with-ca-bundle=FILE],
[Path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
-AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
+AS_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
[
want_ca="$withval"
if test "x$want_ca" = "xyes"; then
@@ -2176,12 +2047,12 @@ AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
],
[ want_ca="unset" ])
AC_ARG_WITH(ca-path,
-AC_HELP_STRING([--with-ca-path=DIRECTORY],
+AS_HELP_STRING([--with-ca-path=DIRECTORY],
[Path to a directory containing CA certificates stored individually, with \
their filenames in a hash format. This option can be used with the OpenSSL, \
GnuTLS and mbedTLS backends. Refer to OpenSSL c_rehash for details. \
(example: /etc/certificates)])
-AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
+AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
[
want_capath="$withval"
if test "x$want_capath" = "xyes"; then
@@ -2291,8 +2162,8 @@ AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
AC_MSG_CHECKING([whether to use builtin CA store of SSL library])
AC_ARG_WITH(ca-fallback,
-AC_HELP_STRING([--with-ca-fallback], [Use the built in CA store of the SSL library])
-AC_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the SSL library]),
+AS_HELP_STRING([--with-ca-fallback], [Use the built in CA store of the SSL library])
+AS_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the SSL library]),
[
if test "x$with_ca_fallback" != "xyes" -a "x$with_ca_fallback" != "xno"; then
AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter])
@@ -2353,11 +2224,54 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
AC_MSG_RESULT([yes (large file enabled)])
AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
[Define to 1 if you are building a Windows target with large file support.])
+ AC_SUBST(USE_WIN32_LARGE_FILES, [1])
;;
win32_small_files)
AC_MSG_RESULT([yes (large file disabled)])
AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
[Define to 1 if you are building a Windows target without large file support.])
+ AC_SUBST(USE_WIN32_SMALL_FILES, [1])
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+])
+
+dnl CURL_CHECK_WIN32_CRYPTO
+dnl -------------------------------------------------
+dnl Check if curl's WIN32 crypto lib can be used
+
+AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [
+ AC_REQUIRE([CURL_CHECK_HEADER_WINCRYPT])dnl
+ AC_MSG_CHECKING([whether build target supports WIN32 crypto API])
+ curl_win32_crypto_api="no"
+ if test "$curl_cv_header_wincrypt_h" = "yes"; then
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#include <wincrypt.h>
+ ]],[[
+ HCRYPTPROV hCryptProv;
+ if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+ CryptReleaseContext(hCryptProv, 0);
+ }
+ ]])
+ ],[
+ curl_win32_crypto_api="yes"
+ ])
+ fi
+ case "$curl_win32_crypto_api" in
+ yes)
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(USE_WIN32_CRYPTO, 1,
+ [Define to 1 if you are building a Windows target with crypto API support.])
+ AC_SUBST(USE_WIN32_CRYPTO, [1])
;;
*)
AC_MSG_RESULT([no])
@@ -2506,14 +2420,13 @@ TEST EINVAL TEST
])
-dnl CURL_MAC_CFLAGS
+dnl CURL_DARWIN_CFLAGS
dnl
-dnl Check if -mmacosx-version-min, -miphoneos-version-min or any
-dnl similar are set manually, otherwise do. And set
-dnl -Werror=partial-availability.
+dnl Set -Werror=partial-availability to detect possible breaking code
+dnl with very low deployment targets.
dnl
-AC_DEFUN([CURL_MAC_CFLAGS], [
+AC_DEFUN([CURL_DARWIN_CFLAGS], [
tst_cflags="no"
case $host_os in
@@ -2522,22 +2435,10 @@ AC_DEFUN([CURL_MAC_CFLAGS], [
;;
esac
- AC_MSG_CHECKING([for good-to-use Mac CFLAGS])
+ AC_MSG_CHECKING([for good-to-use Darwin CFLAGS])
AC_MSG_RESULT([$tst_cflags]);
if test "$tst_cflags" = "yes"; then
- AC_MSG_CHECKING([for *version-min in CFLAGS])
- min=""
- if test -z "$(echo $CFLAGS | grep m.*os.*-version-min)"; then
- min="-mmacosx-version-min=10.8"
- CFLAGS="$CFLAGS $min"
- fi
- if test -z "$min"; then
- AC_MSG_RESULT([set by user])
- else
- AC_MSG_RESULT([$min set])
- fi
-
old_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror=partial-availability"
AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])