diff options
author | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2023-02-19 22:49:18 (GMT) |
---|---|---|
committer | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2023-02-19 22:49:18 (GMT) |
commit | a0d42777217296c0a7bdb1e1be8d8f6de1b24dd7 (patch) | |
tree | 8effe94c57b2f9796ba36090b07551baa8f1e1cb /gl/m4/gl-openssl.m4 | |
parent | ca3d59cd6918c9e2739e783b721d4c1122640fd3 (diff) | |
parent | c07206f2ccc2356aa74bc6813a94c2190017d44e (diff) | |
download | monitoring-plugins-a0d42777217296c0a7bdb1e1be8d8f6de1b24dd7.tar.gz |
Merge remote-tracking branch 'origin/master' into feature_check_disk_add_ignore_missing_option
Diffstat (limited to 'gl/m4/gl-openssl.m4')
-rw-r--r-- | gl/m4/gl-openssl.m4 | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/gl/m4/gl-openssl.m4 b/gl/m4/gl-openssl.m4 new file mode 100644 index 0000000..7eab4e1 --- /dev/null +++ b/gl/m4/gl-openssl.m4 | |||
@@ -0,0 +1,76 @@ | |||
1 | # gl-openssl.m4 serial 6 | ||
2 | dnl Copyright (C) 2013-2023 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT], | ||
8 | [ | ||
9 | m4_define([gl_CRYPTO_CHECK_DEFAULT], [$1]) | ||
10 | ]) | ||
11 | gl_SET_CRYPTO_CHECK_DEFAULT([no]) | ||
12 | |||
13 | AC_DEFUN([gl_CRYPTO_CHECK], | ||
14 | [ | ||
15 | dnl gnulib users set this before gl_INIT with gl_SET_CRYPTO_CHECK_DEFAULT() | ||
16 | m4_divert_once([DEFAULTS], [with_openssl_default='gl_CRYPTO_CHECK_DEFAULT']) | ||
17 | |||
18 | dnl Only clear once, so crypto routines can be checked for individually | ||
19 | m4_divert_once([DEFAULTS], [LIB_CRYPTO=]) | ||
20 | |||
21 | AC_ARG_WITH([openssl], | ||
22 | [[ --with-openssl[=ARG] use libcrypto hash routines for the hash functions | ||
23 | MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512. | ||
24 | Valid ARGs are: | ||
25 | 'yes', | ||
26 | 'no', | ||
27 | 'auto' => use if any version available, | ||
28 | 'auto-gpl-compat' => use if GPL compatible version | ||
29 | available, | ||
30 | 'optional' => use if available | ||
31 | and warn if not available; | ||
32 | Default is ']gl_CRYPTO_CHECK_DEFAULT['.]m4_ifdef([gl_AF_ALG], [ | ||
33 | Note also --with-linux-crypto, which will enable the | ||
34 | use of Linux kernel crypto routines (if available), | ||
35 | which has precedence for files.])], | ||
36 | [], | ||
37 | [with_openssl=$with_openssl_default]) | ||
38 | |||
39 | AC_SUBST([LIB_CRYPTO]) | ||
40 | if test "x$with_openssl" != xno; then | ||
41 | if test "x$with_openssl" = xauto-gpl-compat; then | ||
42 | AC_CACHE_CHECK([whether openssl is GPL compatible], | ||
43 | [gl_cv_openssl_gpl_compat], | ||
44 | [AC_COMPILE_IFELSE( | ||
45 | [AC_LANG_PROGRAM([[ | ||
46 | #include <openssl/opensslv.h> | ||
47 | #if OPENSSL_VERSION_MAJOR < 3 | ||
48 | #error "openssl >= version 3 not found" | ||
49 | #endif | ||
50 | ]])], | ||
51 | [gl_cv_openssl_gpl_compat=yes], | ||
52 | [gl_cv_openssl_gpl_compat=no])]) | ||
53 | fi | ||
54 | if test "x$with_openssl" != xauto-gpl-compat || | ||
55 | test "x$gl_cv_openssl_gpl_compat" = xyes; then | ||
56 | AC_CHECK_LIB([crypto], [$1], | ||
57 | [AC_CHECK_HEADERS( | ||
58 | m4_if([$1], [MD5], [openssl/md5.h], [openssl/sha.h]), | ||
59 | [LIB_CRYPTO=-lcrypto | ||
60 | AC_DEFINE([HAVE_OPENSSL_$1], [1], | ||
61 | [Define to 1 if libcrypto is used for $1.])])]) | ||
62 | fi | ||
63 | if test "x$LIB_CRYPTO" = x; then | ||
64 | message='openssl development library not found for $1. | ||
65 | If you want to install it, first find the pre-built package name: | ||
66 | - On Debian and Debian-based systems: libssl-dev, | ||
67 | - On Red Hat distributions: openssl-devel. | ||
68 | - Other: https://repology.org/project/openssl/versions' | ||
69 | if test "x$with_openssl" = xyes; then | ||
70 | AC_MSG_ERROR([$message]) | ||
71 | elif test "x$with_openssl" = xoptional; then | ||
72 | AC_MSG_WARN([$message]) | ||
73 | fi | ||
74 | fi | ||
75 | fi | ||
76 | ]) | ||