immutable: Add tests.
[gnulib.git] / m4 / gc.m4
blobb6dec0c959a364407b0d57d64746e2cd754384b3
1 # gc.m4 serial 13
2 dnl Copyright (C) 2005-2021 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.
7 AC_DEFUN([gl_GC],
9   AC_ARG_WITH([libgcrypt],
10     AS_HELP_STRING([--with-libgcrypt], [use libgcrypt for low-level crypto]),
11     libgcrypt=$withval, libgcrypt=no)
12   if test "$libgcrypt" != no; then
13     # gc-libgcrypt.c will fail on startup if we don't have
14     # version 1.4.4 or later, so test for it early. */
15     gl_good_gcrypt=no
16     AM_PATH_LIBGCRYPT([1.4.4], [gl_good_gcrypt=yes],
17       [AC_MSG_ERROR([libgcrypt is too old])])
18     if test "x$gl_good_gcrypt" != xno; then
19       dnl Ignore the value of LIBGCRYPT_LIBS, because it does not include
20       dnl '-lgpg-error'.
21       AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [#include <gcrypt.h>])
22       LIB_CRYPTO="$LIBGCRYPT"
23     else
24       AC_MSG_ERROR([libgcrypt not found])
25     fi
26   fi
27   AC_SUBST([LIB_CRYPTO])
29   AC_REQUIRE([AC_C_RESTRICT])