-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathconfigure.ac
172 lines (133 loc) · 4.57 KB
/
configure.ac
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
AC_INIT
AC_CONFIG_SRCDIR([main.c])
AC_PROG_CC
AC_LANG([C])
AC_PROG_MAKE_SET
AC_PROG_INSTALL
# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change. They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP
AC_SYS_LARGEFILE
AC_ARG_ENABLE(fortify, [ --enable-fortify use 'FORTIFY_SOURCE=3' to harden source code], cf_use_fortify=$enableval, cf_use_fortify=no )
AC_ARG_ENABLE(stack-protect, [ --enable-stack-protect use '-fstack-protector-strong' to harden source code], cf_use_stackprotect=$enableval, cf_use_stackprotect=no )
AC_ARG_ENABLE(harden, [ --enable-harden use 'FORTIFY_SOURCE=3' and stack-protect to harden source code], cf_use_harden=$enableval, cf_use_harden=no )
if test "$cf_use_harden" = "yes"
then
cf_use_fortify="yes"
cf_use_stackprotect="yes"
fi
if test "$cf_use_fortify" = "yes"
then
CFLAGS="$CFLAGS -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"
fi
if test "$cf_use_stackprotect" = "yes"
then
CFLAGS="$CFLAGS -fstack-protector-strong"
fi
AC_ARG_ENABLE(xattr, [ --enable-xattr enable extended file attributes support], cf_enable_xattr=$enableval )
if test "$cf_enable_xattr" = "yes"
then
AC_CHECK_HEADER([sys/extattr.h],[cf_extended_attribs=extattr],[])
AC_CHECK_HEADER([sys/xattr.h],[cf_extended_attribs=xattr],[])
fi
if test "$cf_extended_attribs" = "extattr"
then
AC_DEFINE([USE_EXTATTR], [1])
elif test "$cf_extended_attribs" = "xattr"
then
AC_CHECK_LIB(c,getxattr,,)
cf_have_getxattr=$ac_cv_lib_c_getxattr
if test "$cf_have_getxattr" = "yes"
then
AC_DEFINE([USE_XATTR], [1])
fi
fi
AC_ARG_ENABLE(zlib, [ --enable-zlib use ZLib Compression], cf_use_zlib=$enableval, cf_use_zlib=yes)
if test "$cf_use_zlib" = "yes" -o "$cf_use_ssl" = "yes"
then
AC_CHECK_LIB(z,deflate,,)
cf_have_libz=$ac_cv_lib_z_deflate
fi
AC_ARG_ENABLE(ssl, [ --enable-ssl use Secure Sockets Layer], cf_use_ssl=$enableval, cf_use_ssl=yes )
if test "$cf_use_ssl" = "yes"
then
AC_CHECK_HEADER([openssl/crypto.h], cf_have_crypto_h="Y")
AC_CHECK_HEADER([openssl/ssl.h], cf_have_ssl_h="Y")
if test "$cf_have_crypto_h" = "Y" -a "$cf_have_ssl_h" = "Y"
then
AC_CHECK_LIB(crypto,EVP_CIPHER_CTX_init,,)
cf_have_libcrypto=$ac_cv_lib_crypto_EVP_CIPHER_CTX_init
dnl New versions of openssl seem to lack EVP_CIPHER_CTX_init, so let's look for another function. I've no idea what's going on with openssl, this is why I use libressl instead.
if test "$cf_have_libcrypto" != "yes"
then
AC_CHECK_LIB(crypto,EVP_CIPHER_CTX_new)
cf_have_libcrypto=$ac_cv_lib_crypto_EVP_CIPHER_CTX_new
fi
AC_CHECK_LIB(ssl,SSL_library_init,,)
cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init
dnl New versions of openssl seem to lack SSL_library_init, so let's look for another function. I've no idea what's going on with openssl, this is why I use libressl instead.
if test "$cf_have_libssl" != "yes"
then
AC_CHECK_LIB(ssl,OPENSSL_init_ssl)
cf_have_libssl=$ac_cv_lib_ssl_OPENSSL_init_ssl
fi
fi
fi
AC_ARG_WITH(system-libuseful, [ --with-system-libuseful use systemwide libUseful.so rather than bundled version], cf_with_libuseful=$withval )
if test "$cf_with_libuseful" != "no" -a "$cf_with_libuseful" != ""
then
AC_CHECK_LIB(Useful,[GetToken])
AC_CHECK_LIB(Useful,[TOTP])
fi
if test "$ac_cv_lib_Useful_GetToken" == "yes" -a "$ac_cv_lib_Useful_TOTP" == "yes"
then
echo "Found suitable installed libUseful."
AC_CHECK_LIB([Useful],[OpenSSLVerifyCallback],
[AC_CHECK_LIB([ssl],[SSL_new],,,[-lcrypto -lz])]
[AC_CHECK_LIB([crypto],[ERR_load_CRYPTO_strings],,,[-lz])]
[AC_CHECK_LIB([z],[inflate])]
,,[-lssl -lcrypto -lz])
LUSEFUL="system"
else
if test "$ac_cv_lib_Useful_GetToken" == "yes"
then
echo "Installed libUseful too old, lacks base32 and TOTP functions. Using bundled libUseful."
else
echo "No installed libUseful found, using bundled version."
fi
LUSEFUL="bundled"
STATIC_LIBS="libUseful-5/libUseful.a"
AC_SUBST(STATIC_LIBS)
AC_CONFIG_SUBDIRS([libUseful-5])
fi
echo
echo
echo "############# Hashrat Build Config: #############"
echo "Using $LUSEFUL libUseful"
if test "$ac_cv_sys_file_offset_bits" = "64"
then
echo "Largefiles ( > 2GB ) enabled"
else
echo "Largefiles ( > 2GB ) NOT enabled"
fi
if test "$cf_extended_attribs" = "xattr"
then
echo "File system attributes (xattr) enabled"
elif test "$cf_extended_attribs" = "extattr"
then
echo "File system attributes (extattr) enabled"
else
echo "File system attributes NOT enabled"
fi
if test "$cf_have_libssl" = "yes"
then
echo "SSL/TLS enabled"
else
echo "SSL/TLS NOT enabled"
fi
echo
echo
dnl read Makefile.in and write Makefile
AC_CONFIG_FILES([Makefile])
AC_OUTPUT