2 dnl Copyright 2018-2020 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.
9 AC_DEFUN_ONCE([gl_AF_ALG],
11 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
12 AC_REQUIRE([AC_C_INLINE])
14 dnl Check whether linux/if_alg.h has needed features.
15 AC_CACHE_CHECK([whether linux/if_alg.h has struct sockaddr_alg.],
16 [gl_cv_header_linux_if_alg_salg],
18 [AC_LANG_PROGRAM([[#include <sys/socket.h>
19 #include <linux/if_alg.h>
20 struct sockaddr_alg salg = {
21 .salg_family = AF_ALG,
25 [gl_cv_header_linux_if_alg_salg=yes],
26 [gl_cv_header_linux_if_alg_salg=no])])
27 if test "$gl_cv_header_linux_if_alg_salg" = yes; then
28 AC_DEFINE([HAVE_LINUX_IF_ALG_H], [1],
29 [Define to 1 if you have 'struct sockaddr_alg' defined.])
32 dnl The default is to not use AF_ALG if available,
33 dnl as it's system dependent as to whether the kernel
34 dnl routines are faster than libcrypto for example.
36 AC_ARG_WITH([linux-crypto],
37 [AS_HELP_STRING([[--with-linux-crypto]],
38 [use Linux kernel cryptographic API (if available)])],
39 [use_af_alg=$withval],
41 dnl We cannot use it if it is not available.
42 if test "$gl_cv_header_linux_if_alg_salg" != yes; then
43 if test "$use_af_alg" != no; then
44 AC_MSG_WARN([Linux kernel cryptographic API not found])
49 if test "$use_af_alg" != no; then
54 AC_DEFINE_UNQUOTED([USE_LINUX_CRYPTO_API], [$USE_AF_ALG],
55 [Define to 1 if you want to use the Linux kernel cryptographic API.])