forked from mesalock-linux/mesalink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
363 lines (317 loc) · 10.7 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
AC_INIT([mesalink], m4_esyscmd([grep version Cargo.toml | head -n1 | awk '{print $3}' | tr -d '"' | tr -d "\n"]), [[email protected]])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h:config.in])
: ${CFLAGS=""}
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_PREREQ([2.63])
AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign no-dependencies subdir-objects])
MESALINK_VERSION=$(grep ^version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
AC_SUBST(MESALINK_VERSION)
AC_LANG([C])
AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_INSTALL
AM_PROG_AR
AC_PROG_AWK
LT_PREREQ([2.2])
LT_INIT
LT_LANG([C])
MESALINK_LIBRARY_VERSION=15:1:0
# | | |
# +------+ | +---+
# | | |
# current:revision:age
# | | |
# | | +- increment if interfaces have been added
# | | set to zero if interfaces have been removed
# | | or changed
# | +- increment if source code has changed
# | set to zero if current is incremented
# +- increment if interfaces have been added, removed or changed
AC_SUBST([MESALINK_LIBRARY_VERSION])
AC_CHECK_HEADERS([netdb.h netinet/in.h string.h sys/socket.h unistd.h])
AC_CHECK_FUNCS([gethostbyname memset socket])
AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
AS_IF(test x$CARGO = xno,
AC_MSG_ERROR([cargo is required. Please install the Rust toolchain from https://www.rust-lang.org/])
)
AC_CHECK_PROG(RUSTC, [rustc], [yes], [no])
AS_IF(test x$RUSTC = xno,
AC_MSG_ERROR([rustc is required. Please install the Rust toolchain from https://www.rust-lang.org/])
)
AX_COMPILER_VENDOR
if test x"$ax_cv_c_compiler_vendor" = x"gnu"
then
LT_LINKER_ARGS="-Wl,--gc-sections"
fi
if test x"$ax_cv_c_compiler_vendor" = x"clang"
then
LT_LINKER_ARGS="-Wl,-dead_strip"
fi
AC_SUBST([LT_LINKER_ARGS])
CARGO_RUSTC_ARGS="-- --emit asm"
OPTIMIZE_CFLAGS="-Os -fvisibility=hidden -ffunction-sections -fdata-sections"
DEBUG_CFLAGS="-g -ggdb -O0 -Wall"
AX_DEBUG
if test "$ax_enable_debug" = "yes"
then
CFLAGS="$DEBUG_CFLAGS $CFLAGS"
CARGO_TARGET_SUBDIR=debug
CARGO_RELEASE_ARGS=
else
CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
CARGO_TARGET_SUBDIR=release
CARGO_RELEASE_ARGS=--release
fi
AM_CONDITIONAL([CARGO_DEBUG], [test "x$ax_enable_debug" = "xyes"])
AC_SUBST([CARGO_RELEASE_ARGS])
AC_ARG_ENABLE([rusthost],
[AS_HELP_STRING([--enable-rusthost], [Set the Rust host for cross compilation (default: disabled)])],
[ RUST_HOST=$enableval ],
[ RUST_HOST= ]
)
if test "x$RUST_HOST" = "x"
then
CARGO_TARGET_ARGS=""
CARGO_RUSTC_ARGS="$CARGO_RUSTC_ARGS"
CARGO_TARGET_SUBDIR="$CARGO_TARGET_SUBDIR"
CARGO_TARGET_SUBDIR_ENV_VAR=
else
CARGO_TARGET_ARGS="--target $RUST_HOST"
CARGO_RUSTC_ARGS="$CARGO_RUSTC_ARGS -C linker=$CC"
CARGO_TARGET_SUBDIR="$RUST_HOST/$CARGO_TARGET_SUBDIR"
CARGO_TARGET_SUBDIR_ENV_VAR="CARGO_TARGET_SUBDIR=$CARGO_TARGET_SUBDIR"
fi
RUSTC_VERSION=$( rustc --version | sed 's/[^0-9.]*\([0-9.]*\).*/\1/' )
AX_COMPARE_VERSION([$RUSTC_VERSION], [ge], [1.31.0])
IS_NIGHTLY=$( rustc --version | grep nightly )
RUST_IS_NIGHTLY="no"
if test "x$IS_NIGHTLY" != "x"
then
RUST_IS_NIGHTLY="yes"
CARGO_FEATURES=$CARGO_FEATURES" nightly"
fi
AC_SUBST([CARGO_TARGET_ARGS])
AC_SUBST([CARGO_RUSTC_ARGS])
AC_SUBST([CARGO_TARGET_SUBDIR])
AC_SUBST([CARGO_TARGET_SUBDIR_ENV_VAR])
AC_SUBST([CARGO_FEATURES], [--features ])
CARGO_FEATURES=$CARGO_FEATURES" \""
CONFIG_OPTIONS=""
AC_ARG_ENABLE([jemalloc],
[AS_HELP_STRING([--enable-jemalloc], [Enable Jemalloc memory allocator (default: enabled)])],
[ ENABLE_JEMALLOC=$enableval ],
[ ENABLE_JEMALLOC=no ]
)
if test "$ENABLE_JEMALLOC" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" jemalloc_allocator"
fi
AC_ARG_ENABLE([sni],
[AS_HELP_STRING([--enable-sni], [Enable SNI support (default: enabled)])],
[ ENABLE_SNI=$enableval ],
[ ENABLE_SNI=yes ]
)
if test "$ENABLE_SNI" = "no"
then
CARGO_FEATURES=$CARGO_FEATURES" no_sni_check"
fi
AC_ARG_ENABLE([client],
[AS_HELP_STRING([--enable-client], [Enable client APIs (default: enabled)])],
[ ENABLE_CLIENT=$enableval ],
[ ENABLE_CLIENT=yes ]
)
if test "$ENABLE_CLIENT" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" client_apis"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_CLIENT"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_CLIENT"
fi
AC_ARG_ENABLE([server],
[AS_HELP_STRING([--enable-server], [Enable server APIs (default: enabled)])],
[ ENABLE_SERVER=$enableval ],
[ ENABLE_SERVER=yes ]
)
if test "$ENABLE_SERVER" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" server_apis"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_SERVER"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_SERVER"
fi
AC_ARG_ENABLE([errorstrings],
[AS_HELP_STRING([--enable-errorstrings], [Enable error string table (default: enabled)])],
[ ENABLE_ERROR_STRINGS=$enableval ],
[ ENABLE_ERROR_STRINGS=yes ]
)
if test "$ENABLE_ERROR_STRINGS" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" error_strings"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_ERROR_STRINGS"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_ERROR_STRINGS"
fi
AC_ARG_ENABLE([aesgcm],
[AS_HELP_STRING([--enable-aesgcm], [Enable AES-GCM bulk encryption (default: enabled)])],
[ ENABLE_AESGCM=$enableval ],
[ ENABLE_AESGCM=yes ]
)
if test "$ENABLE_AESGCM" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" aesgcm"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_AESGCM"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_AESGCM"
fi
AC_ARG_ENABLE([chachapoly],
[AS_HELP_STRING([--enable-chachapoly], [Enable Chacha20Poly1305 bulk encryption (default: enabled)])],
[ ENABLE_CHACHAPOLY=$enableval ],
[ ENABLE_CHACHAPOLY=yes ]
)
if test "$ENABLE_CHACHAPOLY" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" chachapoly"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_CHACHAPOLY"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_CHACHAPOLY"
fi
AC_ARG_ENABLE([tls13],
[AS_HELP_STRING([--enable-tls13], [Enable TLS 1.3 draft (default: enabled)])],
[ ENABLE_TLS13=$enableval ],
[ ENABLE_TLS13=yes ]
)
if test "$ENABLE_TLS13" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" tls13"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_TLS13"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_TLS13"
fi
AC_ARG_ENABLE([x25519],
[AS_HELP_STRING([--enable-x25519], [Enable Curve25519 for key exchange (default: enabled)])],
[ ENABLE_X25519=$enableval ],
[ ENABLE_X25519=yes ]
)
if test "$ENABLE_X25519" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" x25519"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_X25519"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_X25519"
fi
AC_ARG_ENABLE([ecdh],
[AS_HELP_STRING([--enable-ecdh], [Enable curve secp256r1 and secp384r1 for key exchange (default: enabled)])],
[ ENABLE_ECDH=$enableval ],
[ ENABLE_ECDH=yes ]
)
if test "$ENABLE_ECDH" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" ecdh"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_ECDH"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_ECDH"
fi
AC_ARG_ENABLE([ecdsa],
[AS_HELP_STRING([--enable-ecdsa], [Enable curve secp256r1 and secp384r1 for signature verification (default: enabled)])],
[ ENABLE_ECDSA=$enableval ],
[ ENABLE_ECDSA=yes ]
)
if test "$ENABLE_ECDSA" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" ecdsa"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_ECDSA"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_ECDSA"
fi
AC_ARG_ENABLE([sgx],
[AS_HELP_STRING([--enable-sgx], [Enable experimental SGX attestation (default: disabled)])],
[ ENABLE_SGX=$enableval ],
[ ENABLE_SGX=no ]
)
if test "$ENABLE_SGX" = "yes"
then
CARGO_FEATURES=$CARGO_FEATURES" sgx"
CONFIG_OPTIONS="$CONFIG_OPTIONS HAVE_SGX"
else
CONFIG_OPTIONS="$CONFIG_OPTIONS NO_SGX"
fi
CARGO_FEATURES=$CARGO_FEATURES" verifier"
CARGO_FEATURES=$CARGO_FEATURES"\""
AC_ARG_ENABLE([examples],
[AS_HELP_STRING([--enable-examples], [Enable examples (default: disabled)])],
[ ENABLE_EXAMPLES=$enableval ],
[ ENABLE_EXAMPLES=no ]
)
AM_CONDITIONAL([BUILD_EXAMPLE_CLIENT], [test "x$ENABLE_EXAMPLES" = "xyes"])
AM_CONDITIONAL([BUILD_EXAMPLE_SERVER], [test "x$ENABLE_EXAMPLES" = "xyes"])
AM_CONDITIONAL([BUILD_EXAMPLE_SGX], [[test "x$ENABLE_EXAMPLES" = "xyes"] && [test "x$ENABLE_SGX" = "xyes"]])
AX_CREATE_GENERIC_CONFIG
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([mesalink/options.h])
AC_CONFIG_FILES([mesalink/version.h])
AC_OUTPUT
echo "---"
echo "Running make clean ..."
make clean >/dev/null 2>&1
OPTION_FILE="mesalink/options.h"
rm -f $OPTION_FILE
echo "/* MesaLink options.h" > $OPTION_FILE
echo " * generated from configure options" >> $OPTION_FILE
echo " *" >> $OPTION_FILE
echo " * This file is part of MesaLink. " >> $OPTION_FILE
echo " *" >> $OPTION_FILE
echo " */" >> $OPTION_FILE
echo "" >> $OPTION_FILE
echo "#ifndef MESALINK_OPTIONS_H" >> $OPTION_FILE
echo "#define MESALINK_OPTIONS_H" >> $OPTION_FILE
echo "" >> $OPTION_FILE
echo "" >> $OPTION_FILE
echo "#ifdef __cplusplus" >> $OPTION_FILE
echo "extern \"C\" {" >> $OPTION_FILE
echo "#endif" >> $OPTION_FILE
echo "" >> $OPTION_FILE
for option in $CONFIG_OPTIONS; do
echo "#undef $option" >> $OPTION_FILE
echo "#define $option" >> $OPTION_FILE
echo "" >> $OPTION_FILE
done
echo "" >> $OPTION_FILE
echo "#ifdef __cplusplus" >> $OPTION_FILE
echo "}" >> $OPTION_FILE
echo "#endif" >> $OPTION_FILE
echo "" >> $OPTION_FILE
echo "" >> $OPTION_FILE
echo "#endif /* MESALINK_OPTIONS_H */" >> $OPTION_FILE
echo "" >> $OPTION_FILE
echo
echo "---"
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
echo ""
echo " * Installation prefix: $prefix"
echo " * Host: $host_cpu-$host_vendor-$host_os"
echo " * Rust Host: $RUST_HOST"
echo " * C Compiler: $CC"
echo " * C Compiler vendor: $ax_cv_c_compiler_vendor"
echo " * C Flags: $CFLAGS"
echo " * Debug enabled: $ax_enable_debug"
echo " * Rust version: $RUSTC_VERSION"
echo " * Nightly Rust: $RUST_IS_NIGHTLY"
echo " * Examples: $ENABLE_EXAMPLES"
echo
echo " Features "
echo " * Jemalloc: $ENABLE_JEMALLOC"
echo " * Logging and error strings: $ENABLE_ERROR_STRINGS"
echo " * Check SNI: $ENABLE_SNI"
echo " * AES-GCM: $ENABLE_AESGCM"
echo " * Chacha20-Poly1305: $ENABLE_CHACHAPOLY"
echo " * TLS 1.3: $ENABLE_TLS13"
echo " * X25519 key exchange: $ENABLE_X25519"
echo " * EC key exchange: $ENABLE_ECDH"
echo " * RSA signature verification: yes"
echo " * EC signature verification: $ENABLE_ECDSA"
echo " * SGX attestation: $ENABLE_SGX"
echo ""
echo "---"