-
Notifications
You must be signed in to change notification settings - Fork 3
/
acinclude.m4
84 lines (70 loc) · 2.21 KB
/
acinclude.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
dnl Checks for required headers and functions
dnl
dnl Version: 20200104
dnl Function to detect if libhmac dependencies are available
AC_DEFUN([AX_LIBHMAC_CHECK_LOCAL],
[dnl Check for libcrypto (openssl) support
AX_LIBCRYPTO_CHECK_ENABLE
AS_IF(
[test "x$ac_cv_libcrypto" != xno],
[AX_LIBCRYPTO_CHECK_MD5
AX_LIBCRYPTO_CHECK_SHA1
AX_LIBCRYPTO_CHECK_SHA224
AX_LIBCRYPTO_CHECK_SHA256
AX_LIBCRYPTO_CHECK_SHA512])
dnl Fallback to local versions if necessary
AS_IF(
[test "x$ac_cv_libcrypto" = xno || test "x$ac_cv_libcrypto_md5" = xno],
[ac_cv_libhmac_md5=local],
[ac_cv_libhmac_md5=$ac_cv_libcrypto_md5])
AS_IF(
[test "x$ac_cv_libcrypto" = xno || test "x$ac_cv_libcrypto_sha1" = xno],
[ac_cv_libhmac_sha1=local],
[ac_cv_libhmac_sha1=$ac_cv_libcrypto_sha1])
AS_IF(
[test "x$ac_cv_libcrypto" = xno || test "x$ac_cv_libcrypto_sha224" = xno],
[ac_cv_libhmac_sha224=local],
[ac_cv_libhmac_sha224=$ac_cv_libcrypto_sha224])
AS_IF(
[test "x$ac_cv_libcrypto" = xno || test "x$ac_cv_libcrypto_sha256" = xno],
[ac_cv_libhmac_sha256=local],
[ac_cv_libhmac_sha256=$ac_cv_libcrypto_sha256])
AS_IF(
[test "x$ac_cv_libcrypto" = xno || test "x$ac_cv_libcrypto_sha512" = xno],
[ac_cv_libhmac_sha512=local],
[ac_cv_libhmac_sha512=$ac_cv_libcrypto_sha512])
])
dnl Function to detect if hmactools dependencies are available
AC_DEFUN([AX_HMACTOOLS_CHECK_LOCAL],
[AC_CHECK_HEADERS([signal.h sys/signal.h unistd.h])
AC_CHECK_FUNCS([close getopt setvbuf])
AS_IF(
[test "x$ac_cv_func_close" != xyes],
[AC_MSG_FAILURE(
[Missing function: close],
[1])
])
])
dnl Function to check if DLL support is needed
AC_DEFUN([AX_LIBHMAC_CHECK_DLL_SUPPORT],
[AS_IF(
[test "x$enable_shared" = xyes && test "x$ac_cv_enable_static_executables" = xno],
[AS_CASE(
[$host],
[*cygwin* | *mingw* | *msys*],
[AC_DEFINE(
[HAVE_DLLMAIN],
[1],
[Define to 1 to enable the DllMain function.])
AC_SUBST(
[HAVE_DLLMAIN],
[1])
AC_SUBST(
[LIBHMAC_DLL_EXPORT],
["-DLIBHMAC_DLL_EXPORT"])
AC_SUBST(
[LIBHMAC_DLL_IMPORT],
["-DLIBHMAC_DLL_IMPORT"])
])
])
])