]>
Commit | Line | Data |
---|---|---|
8ae5b576 | 1 | dnl -*- mode: shell-script; sh-indentation: 2; -*- |
8ae5b576 | 2 | |
2ed0c4b5 NM |
3 | dnl Process this file with autoconf to produce a configure script. |
4 | ||
6a525b50 | 5 | AC_INIT([nettle], [3.10], [nettle-bugs@lists.lysator.liu.se]) |
95fa09b7 | 6 | AC_PREREQ([2.69]) |
79e51eaa | 7 | AC_CONFIG_SRCDIR([nettle-types.h]) |
87310cad NM |
8 | # Needed to stop autoconf from looking for files in parent directories. |
9 | AC_CONFIG_AUX_DIR([.]) | |
10 | ||
95fa09b7 | 11 | AC_CONFIG_HEADERS([config.h]) |
582374c2 | 12 | |
a46b9c78 | 13 | LIBNETTLE_MAJOR=8 |
6a525b50 | 14 | LIBNETTLE_MINOR=9 |
c40f0aa2 | 15 | |
a9e22e5e | 16 | LIBHOGWEED_MAJOR=6 |
6a525b50 | 17 | LIBHOGWEED_MINOR=9 |
a9981290 | 18 | |
5b9eb472 NM |
19 | dnl Note double square brackets, for extra m4 quoting. |
20 | MAJOR_VERSION=`echo $PACKAGE_VERSION | sed 's/^\([[^.]]*\)\..*/\1/'` | |
21 | MINOR_VERSION=`echo $PACKAGE_VERSION | sed 's/^[[^.]]*\.\([[0-9]]*\).*/\1/'` | |
7bd82266 NM |
22 | AC_SUBST([MAJOR_VERSION]) |
23 | AC_SUBST([MINOR_VERSION]) | |
24 | ||
ccecfc93 NM |
25 | AC_CANONICAL_HOST |
26 | ||
552fd16e NM |
27 | # Command line options |
28 | AC_ARG_WITH(include-path, | |
95fa09b7 | 29 | AS_HELP_STRING([--with-include-path], [A colon-separated list of directories to search for include files]),, |
552fd16e NM |
30 | [with_include_path='']) |
31 | ||
32 | if test x$with_include_path != x ; then | |
bcc838be | 33 | CPPFLAGS="$CPPFLAGS -I`echo $with_include_path | sed 's/:/ -I/g'`" |
552fd16e NM |
34 | fi |
35 | ||
36 | AC_ARG_WITH(lib-path, | |
95fa09b7 | 37 | AS_HELP_STRING([--with-lib-path], [A colon-separated list of directories to search for libraries]),, |
552fd16e NM |
38 | [with_lib_path='']) |
39 | ||
40 | if test x$with_lib_path != x ; then | |
bcc838be | 41 | LDFLAGS="$LDFLAGS -L`echo $with_lib_path | sed 's/:/ -L/g'`" |
552fd16e NM |
42 | fi |
43 | ||
5aa8abd0 | 44 | AC_ARG_ENABLE(public-key, |
95fa09b7 | 45 | AS_HELP_STRING([--disable-public-key], [Disable public key algorithms]),, |
5aa8abd0 NM |
46 | [enable_public_key=yes]) |
47 | ||
ccecfc93 | 48 | AC_ARG_ENABLE(assembler, |
95fa09b7 | 49 | AS_HELP_STRING([--disable-assembler], [Disable assembler code]),, |
5aa8abd0 | 50 | [enable_assembler=yes]) |
ccecfc93 | 51 | |
b8e111bd | 52 | AC_ARG_ENABLE(static, |
95fa09b7 | 53 | AS_HELP_STRING([--disable-static], [Do not build any static library]),, |
b8e111bd NM |
54 | [enable_static=yes]) |
55 | ||
a9981290 | 56 | AC_ARG_ENABLE(shared, |
95fa09b7 | 57 | AS_HELP_STRING([--disable-shared], [Do not build any shared library]),, |
b517f5b9 | 58 | [enable_shared=yes]) |
a9981290 | 59 | |
6797ac43 | 60 | AC_ARG_ENABLE(pic, |
95fa09b7 | 61 | AS_HELP_STRING([--disable-pic], [Do not try to compile library files as position independent code]),, |
6797ac43 NM |
62 | [enable_pic=yes]) |
63 | ||
c2098091 | 64 | AC_ARG_ENABLE(openssl, |
95fa09b7 | 65 | AS_HELP_STRING([--disable-openssl], [Do not include openssl glue in the benchmark program]),, |
c2098091 | 66 | [enable_openssl=yes]) |
3ab6b33c DM |
67 | |
68 | AC_ARG_ENABLE(gcov, | |
95fa09b7 | 69 | AS_HELP_STRING([--enable-gcov], [Instrument for gcov (requires a modern gcc)]),, |
3ab6b33c DM |
70 | [enable_gcov=no]) |
71 | ||
244588a4 | 72 | AC_ARG_ENABLE(documentation, |
95fa09b7 | 73 | AS_HELP_STRING([--disable-documentation], [Omit building and installing the documentation. (default=auto)]),, |
244588a4 ST |
74 | [enable_documentation=auto]) |
75 | ||
95fa09b7 | 76 | AC_ARG_ENABLE(fat, AS_HELP_STRING([--disable-fat], [Disable fat library build]),, |
d5650360 | 77 | [enable_fat=yes]) |
aa7ad293 | 78 | |
ade7779c | 79 | AC_ARG_ENABLE(arm-neon, |
95fa09b7 | 80 | AS_HELP_STRING([--enable-arm-neon], [Enable ARM Neon assembly. (default=auto)]),, |
ade7779c NM |
81 | [enable_arm_neon=auto]) |
82 | ||
a471ae85 | 83 | AC_ARG_ENABLE(arm64-crypto, |
95fa09b7 | 84 | AS_HELP_STRING([--enable-arm64-crypto], [Enable Arm64 crypto extension. (default=no)]),, |
a471ae85 | 85 | [enable_arm64_crypto=no]) |
09d77a10 | 86 | |
530014f3 | 87 | AC_ARG_ENABLE(x86-aesni, |
95fa09b7 | 88 | AS_HELP_STRING([--enable-x86-aesni], [Enable x86_64 aes instructions. (default=no)]),, |
530014f3 NM |
89 | [enable_x86_aesni=no]) |
90 | ||
74c9af26 | 91 | AC_ARG_ENABLE(x86-sha-ni, |
95fa09b7 | 92 | AS_HELP_STRING([--enable-x86-sha-ni], [Enable x86_64 sha_ni instructions. (default=no)]),, |
74c9af26 NM |
93 | [enable_x86_sha_ni=no]) |
94 | ||
f8fa4f1f | 95 | AC_ARG_ENABLE(x86-pclmul, |
95fa09b7 | 96 | AS_HELP_STRING([--enable-x86-pclmul], [Enable x86_64 pclmulqdq instructions. (default=no)]),, |
f8fa4f1f NM |
97 | [enable_x86_pclmul=no]) |
98 | ||
152da08e | 99 | AC_ARG_ENABLE(power-crypto-ext, |
95fa09b7 | 100 | AS_HELP_STRING([--enable-power-crypto-ext], [Enable POWER crypto extensions. (default=no)]),, |
456137ff | 101 | [enable_power_crypto_ext=no]) |
152da08e | 102 | |
cfd769e5 | 103 | AC_ARG_ENABLE(power-altivec, |
95fa09b7 | 104 | AS_HELP_STRING([--enable-power-altivec], [Enable POWER altivec and vsx extensions. (default=no)]),, |
cfd769e5 NM |
105 | [enable_altivec=no]) |
106 | ||
c4856c14 | 107 | AC_ARG_ENABLE(power9, |
95fa09b7 | 108 | AS_HELP_STRING([--enable-power9], [Enable POWER ISA v3.0. (default=no)]),, |
c4856c14 MT |
109 | [enable_power9=no]) |
110 | ||
b8054a1d | 111 | AC_ARG_ENABLE(s390x-vf, |
95fa09b7 | 112 | AS_HELP_STRING([--enable-s390x-vf], [Enable vector facility on z/Architecture. (default=no)]),, |
b8054a1d MT |
113 | [enable_s390x_vf=no]) |
114 | ||
71dafe91 | 115 | AC_ARG_ENABLE(s390x-msa, |
95fa09b7 | 116 | AS_HELP_STRING([--enable-s390x-msa], [Enable message-security assist extensions on z/Architecture. (default=no)]),, |
71dafe91 | 117 | [enable_s390x_msa=no]) |
0bff7a2b | 118 | |
0e1d3111 NM |
119 | AC_ARG_ENABLE(extra-asserts, |
120 | AS_HELP_STRING([--enable-extra-asserts], [Enable additional asserts in ECC code (incompatible side-channel tests)]),, | |
121 | [enable_extra_asserts=no]) | |
122 | ||
2a22cbdc | 123 | AC_ARG_ENABLE(mini-gmp, |
95fa09b7 | 124 | AS_HELP_STRING([--enable-mini-gmp], [Enable mini-gmp, used instead of libgmp.]),, |
2a22cbdc NM |
125 | [enable_mini_gmp=no]) |
126 | ||
0cecedba NM |
127 | AC_ARG_VAR(ASM_FLAGS, [Extra flags for processing assembly source files]) |
128 | ||
2a22cbdc NM |
129 | if test "x$enable_mini_gmp" = xyes ; then |
130 | NETTLE_USE_MINI_GMP=1 | |
d353fb79 | 131 | HOGWEED_EXTRA_SYMBOLS="mpz_*;gmp_*;mpn_*;mp_*;" |
2a22cbdc NM |
132 | else |
133 | NETTLE_USE_MINI_GMP=0 | |
d1c1ebd9 | 134 | HOGWEED_EXTRA_SYMBOLS="" |
2a22cbdc NM |
135 | fi |
136 | AC_SUBST([NETTLE_USE_MINI_GMP]) | |
d1c1ebd9 | 137 | AC_SUBST([HOGWEED_EXTRA_SYMBOLS]) |
2a22cbdc | 138 | |
0e1d3111 NM |
139 | AH_TEMPLATE([WITH_EXTRA_ASSERTS], [Defined to enable additional asserts]) |
140 | if test "$enable_extra_asserts" = yes ; then | |
141 | AC_DEFINE(WITH_EXTRA_ASSERTS) | |
142 | fi | |
143 | ||
552fd16e NM |
144 | LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \ |
145 | `echo $exec_prefix | sed "s@^NONE@$prefix/lib@g" | sed "s@^NONE@$ac_default_prefix/lib@g"` \ | |
146 | /usr/local/lib /sw/local/lib /sw/lib \ | |
147 | /usr/gnu/lib /opt/gnu/lib /sw/gnu/lib /usr/freeware/lib /usr/pkg/lib]) | |
148 | ||
4bbf08c3 | 149 | # Checks for programs. |
94cb1bf0 | 150 | AC_PROG_CC |
d388d925 | 151 | |
2185ed0d NM |
152 | NETTLE_CHECK_IFUNC |
153 | ||
f2b218bc NM |
154 | # Used by the testsuite only |
155 | AC_PROG_CXX | |
156 | ||
157 | AC_LANG_PUSH(C++) | |
95fa09b7 | 158 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])], [IF_CXX=''], [IF_CXX='#']) |
75b7234d | 159 | AC_SUBST([IF_CXX]) |
f2b218bc NM |
160 | AC_LANG_POP |
161 | ||
d1c1ebd9 NM |
162 | LD_VERSION_SCRIPT |
163 | ||
8ae5b576 | 164 | AC_PROG_MAKE_SET |
94cb1bf0 | 165 | AC_PROG_RANLIB |
768bcd1d | 166 | AC_CHECK_TOOL(NM, nm, strings) |
9da85cdf NM |
167 | # Used only for the GNU-stack configure test. |
168 | AC_CHECK_TOOL(OBJDUMP, objdump, false) | |
fad85c4e | 169 | AC_CHECK_TOOL(AR, ar, false) |
94cb1bf0 | 170 | |
4cf5a322 NM |
171 | AC_PROG_INSTALL |
172 | ||
b465edbe NM |
173 | # According to the autoconf manual, needs install-sh from |
174 | # autoconf-2.60 or automake-1.10 to avoid races. | |
175 | AC_PROG_MKDIR_P | |
176 | ||
d41c940c NM |
177 | AC_PROG_LN_S |
178 | ||
ae944d88 NM |
179 | # Compiler tests for the build system |
180 | GMP_PROG_CC_FOR_BUILD | |
181 | GMP_PROG_EXEEXT_FOR_BUILD | |
182 | ||
97f9b45b NM |
183 | # Check if valgrind is working; expected to fail in cross builds. |
184 | NETTLE_PROG_VALGRIND | |
185 | ||
4cf5a322 NM |
186 | LSH_DEPENDENCY_TRACKING |
187 | ||
9c95a3d3 NM |
188 | if test "x$enable_gcov" = "xyes"; then |
189 | CFLAGS="$CFLAGS -ftest-coverage -fprofile-arcs" | |
190 | fi | |
191 | ||
192 | # Checks for typedefs, structures, and compiler characteristics. | |
193 | AC_C_CONST | |
194 | AC_C_INLINE | |
195 | AC_TYPE_UID_T | |
196 | AC_TYPE_SIZE_T | |
9c95a3d3 NM |
197 | AC_CHECK_SIZEOF(long) |
198 | AC_CHECK_SIZEOF(size_t) | |
199 | ||
072d2aa0 | 200 | AC_CHECK_HEADERS([openssl/evp.h openssl/ec.h openssl/rsa.h],, |
9c95a3d3 NM |
201 | [enable_openssl=no |
202 | break]) | |
203 | ||
7123800a | 204 | # For use by the testsuite |
9c95a3d3 | 205 | AC_CHECK_HEADERS([valgrind/memcheck.h]) |
7123800a NM |
206 | AC_CHECK_HEADERS([dlfcn.h]) |
207 | AC_CHECK_LIB([dl], [dlopen], | |
208 | [AC_DEFINE([HAVE_LIBDL], 1, | |
209 | [Define to 1 if you have dlopen (with -ldl).])]) | |
9c95a3d3 NM |
210 | |
211 | LSH_FUNC_ALLOCA | |
6dd5bd6c | 212 | |
9c95a3d3 NM |
213 | # getenv_secure is used for fat overrides, |
214 | # getline is used in the testsuite | |
215 | AC_CHECK_FUNCS(secure_getenv getline) | |
d5738a57 MW |
216 | |
217 | ASM_WORDS_BIGENDIAN=unknown | |
218 | AC_C_BIGENDIAN([AC_DEFINE([WORDS_BIGENDIAN], 1) | |
219 | ASM_WORDS_BIGENDIAN=yes], | |
220 | [ASM_WORDS_BIGENDIAN=no]) | |
9c95a3d3 | 221 | |
64454448 NM |
222 | AC_CACHE_CHECK([for __builtin_bswap64], |
223 | nettle_cv_c_builtin_bswap64, | |
95fa09b7 | 224 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
64454448 | 225 | #include <stdint.h> |
95fa09b7 | 226 | ]], [[ |
64454448 NM |
227 | uint64_t x = 17; |
228 | uint64_t y = __builtin_bswap64(x); | |
95fa09b7 NM |
229 | ]])], |
230 | [nettle_cv_c_builtin_bswap64=yes], | |
231 | [nettle_cv_c_builtin_bswap64=no])]) | |
64454448 NM |
232 | |
233 | AH_TEMPLATE([HAVE_BUILTIN_BSWAP64], [Define if __builtin_bswap64 is available]) | |
234 | if test "x$nettle_cv_c_builtin_bswap64" = "xyes" ; then | |
235 | AC_DEFINE(HAVE_BUILTIN_BSWAP64) | |
236 | fi | |
237 | ||
9c95a3d3 NM |
238 | LSH_GCC_ATTRIBUTES |
239 | ||
9c95a3d3 NM |
240 | # Check for file locking. We (AC_PROG_CC?) have already checked for |
241 | # sys/types.h and unistd.h. | |
242 | AC_CACHE_CHECK([for fcntl file locking], | |
243 | nettle_cv_fcntl_locking, | |
95fa09b7 | 244 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
9c95a3d3 NM |
245 | #if HAVE_SYS_TYPES_H |
246 | # include <sys/types.h> | |
247 | #endif | |
248 | #if HAVE_UNISTD_H | |
249 | # include <unistd.h> | |
250 | #endif | |
251 | #include <fcntl.h> | |
95fa09b7 | 252 | ]], [[ |
9c95a3d3 NM |
253 | int op = F_SETLKW; |
254 | struct flock fl; | |
95fa09b7 NM |
255 | ]])], |
256 | [nettle_cv_fcntl_locking=yes], | |
257 | [nettle_cv_fcntl_locking=no])]) | |
9c95a3d3 NM |
258 | |
259 | AH_TEMPLATE([HAVE_FCNTL_LOCKING], [Define if fcntl file locking is available]) | |
260 | if test "x$nettle_cv_fcntl_locking" = "xyes" ; then | |
261 | AC_DEFINE(HAVE_FCNTL_LOCKING) | |
262 | fi | |
263 | ||
264 | # Checks for libraries | |
265 | if test "x$enable_public_key" = "xyes" ; then | |
266 | if test "x$enable_mini_gmp" = "xno" ; then | |
4489fd6f NM |
267 | # mpn_zero_p was added in GMP-6.1.0 |
268 | AC_CHECK_LIB(gmp, __gmpn_zero_p,, | |
9c95a3d3 | 269 | [AC_MSG_WARN( |
4489fd6f | 270 | [GNU MP not found, or too old. GMP-6.1.0 or later is needed, see https://gmplib.org/. |
9c95a3d3 NM |
271 | Support for public key algorithms will be unavailable.])] |
272 | enable_public_key=no) | |
273 | ||
274 | # Add -R flags needed to run programs linked with gmp | |
275 | LSH_RPATH_FIX | |
276 | fi | |
277 | fi | |
278 | ||
279 | nettle_cv_gmp_numb_bits=0 | |
280 | if test "x$enable_public_key" = "xyes" ; then | |
281 | # Check for gmp limb size | |
282 | if test "x$enable_mini_gmp" = "xyes" ; then | |
283 | AC_MSG_CHECKING([for mini-gmp limb size]) | |
284 | # With mini-gmp, mp_limb_t is always unsigned long. | |
285 | AC_COMPUTE_INT(nettle_cv_gmp_numb_bits, [(sizeof(unsigned long) * CHAR_BIT)], | |
286 | [#include <limits.h>], | |
287 | [AC_MSG_FAILURE([cannot find value of GMP_NUMB_BITS])]) | |
288 | ||
289 | AC_MSG_RESULT([$nettle_cv_gmp_numb_bits bits]) | |
290 | else | |
291 | AC_MSG_CHECKING([for GMP limb size]) | |
292 | AC_COMPUTE_INT(nettle_cv_gmp_numb_bits, [GMP_NUMB_BITS], | |
293 | [#include <gmp.h>], | |
294 | [AC_MSG_FAILURE([cannot find value of GMP_NUMB_BITS])]) | |
295 | ||
296 | AC_MSG_RESULT([$nettle_cv_gmp_numb_bits bits]) | |
297 | fi | |
298 | fi | |
299 | ||
b7052093 NM |
300 | # Substituted in Makefile, passed on to the eccdata command. |
301 | NUMB_BITS="$nettle_cv_gmp_numb_bits" | |
302 | AC_SUBST([NUMB_BITS]) | |
303 | ||
304 | # Substituted in version.h, used only with mini-gmp. | |
305 | if test "x$enable_mini_gmp" = "xyes" ; then | |
306 | GMP_NUMB_BITS="$NUMB_BITS" | |
307 | else | |
308 | GMP_NUMB_BITS="n/a" | |
309 | fi | |
9c95a3d3 NM |
310 | AC_SUBST([GMP_NUMB_BITS]) |
311 | ||
19c13e25 | 312 | # Figure out ABI. Currently, configurable only by setting CFLAGS. |
4e8e6d70 NM |
313 | ABI=standard |
314 | ||
c7cf1939 NM |
315 | ELFV2_ABI=no # For powerpc64 |
316 | W64_ABI=no # For x86_64 windows | |
317 | ||
66681e0a | 318 | case "$host_cpu" in |
11960a80 | 319 | [x86_64 | amd64]) |
95fa09b7 | 320 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
4e8e6d70 NM |
321 | #if defined(__x86_64__) || defined(__arch64__) |
322 | #error 64-bit x86 | |
69c38ef5 | 323 | #endif |
95fa09b7 | 324 | ]], [[]])], [ |
4e8e6d70 | 325 | ABI=32 |
69c38ef5 | 326 | ], [ |
4e8e6d70 | 327 | ABI=64 |
69c38ef5 | 328 | ]) |
11960a80 | 329 | ;; |
66681e0a | 330 | *sparc*) |
95fa09b7 | 331 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
8e988473 NM |
332 | #if defined(__sparcv9) || defined(__arch64__) |
333 | #error 64-bit sparc | |
b7dd9283 | 334 | #endif |
95fa09b7 | 335 | ]], [[]])], [ |
b7dd9283 KZ |
336 | ABI=32 |
337 | ], [ | |
338 | ABI=64 | |
339 | ]) | |
340 | ;; | |
0681cfd3 | 341 | *mips64*) |
95fa09b7 | 342 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
c82f4ab1 | 343 | #if defined(__mips64) || defined(__mips64__) || (defined(__sgi) && defined(__LP64__)) |
61870a81 | 344 | #error 64-bit mips |
1b75cecc | 345 | #endif |
95fa09b7 | 346 | ]], [[]])], [ |
1b75cecc NM |
347 | ABI=32 |
348 | ], [ | |
349 | ABI=64 | |
350 | ]) | |
351 | ;; | |
352 | *powerpc64*) | |
95fa09b7 | 353 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
1b75cecc NM |
354 | #if defined(__PPC64__) |
355 | #error 64-bit powerpc | |
8e988473 | 356 | #endif |
95fa09b7 | 357 | ]], [[]])], [ |
4e8e6d70 | 358 | ABI=32 |
8e988473 | 359 | ], [ |
4e8e6d70 | 360 | ABI=64 |
8e988473 | 361 | ]) |
c7cf1939 | 362 | if test "$ABI" = 64 ; then |
95fa09b7 | 363 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
c7cf1939 NM |
364 | #if _CALL_ELF == 2 |
365 | #error ELFv2 ABI | |
366 | #endif | |
95fa09b7 | 367 | ]], [[]])], [], [ |
c7cf1939 NM |
368 | ELFV2_ABI=yes |
369 | ]) | |
370 | fi | |
ccecfc93 | 371 | ;; |
09d77a10 | 372 | aarch64*) |
95fa09b7 | 373 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
ebf9ae83 | 374 | #if defined(__aarch64__) |
09d77a10 | 375 | #error 64-bit arm |
0bff7a2b | 376 | #endif |
95fa09b7 | 377 | ]], [[]])], [ |
0bff7a2b NM |
378 | ABI=32 |
379 | ], [ | |
380 | ABI=64 | |
381 | ]) | |
382 | ;; | |
383 | *s390x*) | |
95fa09b7 | 384 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
0bff7a2b NM |
385 | #if defined(__s390x__) |
386 | #error 64-bit s390x | |
8e988473 | 387 | #endif |
95fa09b7 | 388 | ]], [[]])], [ |
4e8e6d70 | 389 | ABI=32 |
8e988473 | 390 | ], [ |
4e8e6d70 | 391 | ABI=64 |
8e988473 | 392 | ]) |
ccecfc93 | 393 | ;; |
4e8e6d70 NM |
394 | esac |
395 | ||
396 | if test "x$ABI" != xstandard ; then | |
56cc838c | 397 | AC_MSG_NOTICE([Compiler uses $ABI-bit ABI. To change, set CC.]) |
172f948f NM |
398 | if test "$libdir" = '${exec_prefix}/lib' ; then |
399 | # Try setting a better default | |
400 | case "$host_cpu:$host_os:$ABI" in | |
401 | *:solaris*:32|*:sunos*:32) | |
402 | libdir='${exec_prefix}/lib' | |
403 | ;; | |
404 | *:solaris*:64|*:sunos*:64) | |
405 | libdir='${exec_prefix}/lib/64' | |
406 | ;; | |
bc7a99fb NM |
407 | # Linux conventions are a mess... According to the Linux File |
408 | # Hierarchy Standard, all architectures except IA64 puts 32-bit | |
409 | # libraries in lib, and 64-bit in lib64. Some distributions, | |
410 | # e.g., Fedora and Gentoo, adhere to this standard, while at | |
411 | # least Debian has decided to put 64-bit libraries in lib and | |
412 | # 32-bit libraries in lib32. | |
413 | ||
414 | # We try to figure out the convention, except if we're cross | |
415 | # compiling. We use lib${ABI} if /usr/lib${ABI} exists and | |
416 | # appears to not be a symlink to a different name. | |
417 | *:linux*:32|*:linux*:64) | |
418 | if test "$cross_compiling" = yes ; then | |
419 | AC_MSG_WARN([Cross compiling for linux. Can't guess if libraries go in lib${ABI} or lib.]); dnl ' | |
420 | else | |
421 | # The dash builtin pwd tries to be "helpful" and remember | |
ba5856e4 | 422 | # symlink names. Use -P option, and hope it's portable enough. |
bc7a99fb | 423 | test -d /usr/lib${ABI} \ |
ba5856e4 | 424 | && (cd /usr/lib${ABI} && pwd -P | grep >/dev/null "/lib${ABI}"'$') \ |
bc7a99fb NM |
425 | && libdir='${exec_prefix}/'"lib${ABI}" |
426 | fi | |
172f948f NM |
427 | ;; |
428 | # On freebsd, it seems 32-bit libraries are in lib32, | |
429 | # and 64-bit in lib. Don't know about "kfreebsd", does | |
430 | # it follow the Linux fhs conventions? | |
431 | *:freebsd*:32) | |
432 | libdir='${exec_prefix}/lib32' | |
433 | ;; | |
434 | *:freebsd*:64) | |
435 | libdir='${exec_prefix}/lib' | |
436 | ;; | |
b7dd9283 KZ |
437 | *:irix*:32) |
438 | libdir='${exec_prefix}/lib32' | |
439 | ;; | |
440 | *:irix*:64) | |
441 | libdir='${exec_prefix}/lib64' | |
442 | ;; | |
172f948f | 443 | *) |
bc7a99fb | 444 | AC_MSG_WARN([Don't know where to install $ABI-bit libraries on this system.]); dnl ' |
172f948f NM |
445 | |
446 | esac | |
447 | AC_MSG_NOTICE([Libraries to be installed in $libdir.]) | |
448 | fi | |
4e8e6d70 NM |
449 | fi |
450 | ||
9dfaebc1 | 451 | OPT_NETTLE_SOURCES="" |
2fe775ee | 452 | FAT_TEST_LIST="" |
2e6c93ca | 453 | ASM_PPC_WANT_R_REGISTERS="n/a" |
9dfaebc1 | 454 | |
4e8e6d70 NM |
455 | # Select assembler code |
456 | asm_path= | |
1eed358e NM |
457 | if test "x$enable_assembler" = xyes ; then |
458 | case "$host_cpu" in | |
215ed332 | 459 | [x86 | i?86* | k[5-8]* | pentium* | athlon]) |
4e8e6d70 | 460 | asm_path=x86 |
1eed358e NM |
461 | ;; |
462 | [x86_64 | amd64]) | |
463 | if test "$ABI" = 64 ; then | |
464 | asm_path=x86_64 | |
aa7ad293 NM |
465 | if test "x$enable_fat" = xyes ; then |
466 | asm_path="x86_64/fat $asm_path" | |
9dfaebc1 | 467 | OPT_NETTLE_SOURCES="fat-x86_64.c $OPT_NETTLE_SOURCES" |
2fe775ee | 468 | # For now, not enabling aesni or sha_ni, since at least |
be245313 | 469 | # the latter appears unavailable on the gitlab test machines. |
2fe775ee | 470 | FAT_TEST_LIST="vendor:intel vendor:amd" |
74c9af26 NM |
471 | else |
472 | if test "x$enable_x86_aesni" = xyes ; then | |
473 | asm_path="x86_64/aesni $asm_path" | |
474 | fi | |
475 | if test "x$enable_x86_sha_ni" = xyes ; then | |
476 | asm_path="x86_64/sha_ni $asm_path" | |
477 | fi | |
f8fa4f1f NM |
478 | if test "x$enable_x86_pclmul" = xyes ; then |
479 | asm_path="x86_64/pclmul $asm_path" | |
480 | fi | |
aa7ad293 | 481 | fi |
1eed358e NM |
482 | else |
483 | asm_path=x86 | |
484 | fi | |
485 | ;; | |
486 | *sparc*) | |
487 | if test "$ABI" = 64 ; then | |
488 | asm_path=sparc64 | |
1eed358e NM |
489 | fi |
490 | ;; | |
3d0fd448 NM |
491 | arm*) |
492 | asm_path=arm | |
493 | if test "x$enable_fat" = xyes ; then | |
494 | asm_path="arm/fat $asm_path" | |
495 | OPT_NETTLE_SOURCES="fat-arm.c $OPT_NETTLE_SOURCES" | |
2fe775ee | 496 | FAT_TEST_LIST="arch:5 arch:6,neon" |
3d0fd448 NM |
497 | else |
498 | case "$host_cpu" in | |
499 | armv6* | armv7*) | |
500 | NETTLE_CHECK_ARM_NEON | |
ade7779c | 501 | |
3d0fd448 | 502 | asm_path="arm/v6 arm" |
3d0fd448 NM |
503 | ;; |
504 | esac | |
cbbc32b3 NM |
505 | if test "x$enable_arm_neon" = xyes ; then |
506 | asm_path="arm/neon $asm_path" | |
507 | fi | |
ade7779c | 508 | fi |
fc5801a7 | 509 | ;; |
ebf9ae83 NM |
510 | aarch64*) |
511 | if test "$ABI" = 64 ; then | |
1585f6ac MT |
512 | asm_path=arm64 |
513 | if test "x$enable_fat" = xyes ; then | |
514 | asm_path="arm64/fat $asm_path" | |
515 | OPT_NETTLE_SOURCES="fat-arm64.c $OPT_NETTLE_SOURCES" | |
39d1e2a3 | 516 | FAT_TEST_LIST="none aes pmull sha1 sha2" |
1585f6ac MT |
517 | else |
518 | if test "$enable_arm64_crypto" = yes ; then | |
519 | asm_path="arm64/crypto $asm_path" | |
520 | fi | |
09d77a10 | 521 | fi |
ebf9ae83 NM |
522 | else |
523 | # As far as I understand, Neon instructions are unlikely to be | |
524 | # missing. It may be omitted "only for implementations | |
525 | # targeting specialized markets", to quote the Armv8 reference | |
526 | # manual. | |
527 | asm_path="arm/neon arm/v6 arm" | |
528 | fi | |
529 | ;; | |
152da08e | 530 | *powerpc64*) |
1b75cecc | 531 | if test "$ABI" = 64 ; then |
2e6c93ca | 532 | GMP_ASM_POWERPC_R_REGISTERS |
cfd769e5 | 533 | asm_path="powerpc64" |
1b75cecc NM |
534 | if test "x$enable_fat" = xyes ; then |
535 | asm_path="powerpc64/fat $asm_path" | |
536 | OPT_NETTLE_SOURCES="fat-ppc.c $OPT_NETTLE_SOURCES" | |
c4856c14 | 537 | FAT_TEST_LIST="none crypto_ext altivec power9" |
cfd769e5 | 538 | else |
c4856c14 MT |
539 | if test "$enable_power9" = yes ; then |
540 | asm_path="powerpc64/p9 $asm_path" | |
541 | fi | |
542 | if test "$enable_power_crypto_ext" = yes ; then | |
cfd769e5 NM |
543 | asm_path="powerpc64/p8 $asm_path" |
544 | fi | |
545 | if test "$enable_power_altivec" = yes ; then | |
546 | asm_path="powerpc64/p7 $asm_path" | |
547 | fi | |
1b75cecc | 548 | fi |
152da08e NM |
549 | fi |
550 | ;; | |
0bff7a2b NM |
551 | *s390x*) |
552 | if test "$ABI" = 64 ; then | |
3be3ff3e MT |
553 | asm_path="s390x" |
554 | if test "x$enable_fat" = xyes ; then | |
555 | asm_path="s390x/fat $asm_path" | |
556 | OPT_NETTLE_SOURCES="fat-s390x.c $OPT_NETTLE_SOURCES" | |
4ea2a1f8 | 557 | FAT_TEST_LIST="none vf msa msa_x1 msa_x2 msa_x4" |
3be3ff3e | 558 | else |
b8054a1d MT |
559 | if test "$enable_s390x_vf" = yes ; then |
560 | asm_path="s390x/vf $asm_path" | |
561 | fi | |
3be3ff3e | 562 | if test "$enable_s390x_msa" = yes ; then |
4ea2a1f8 | 563 | asm_path="s390x/msa s390x/msa_x1 s390x/msa_x2 s390x/msa_x4 $asm_path" |
3be3ff3e MT |
564 | fi |
565 | fi | |
0bff7a2b NM |
566 | fi |
567 | ;; | |
1eed358e NM |
568 | *) |
569 | enable_assembler=no | |
570 | ;; | |
571 | esac | |
572 | fi | |
c8841e69 NM |
573 | |
574 | # Files which replace a C source file (or otherwise don't correspond | |
575 | # to a new object file). | |
576 | asm_replace_list="aes-encrypt-internal.asm aes-decrypt-internal.asm \ | |
038a108d | 577 | aes-invert-internal.asm \ |
c23701f3 NM |
578 | aes128-set-encrypt-key.asm aes128-set-decrypt-key.asm \ |
579 | aes128-encrypt.asm aes128-decrypt.asm \ | |
580 | aes192-set-encrypt-key.asm aes192-set-decrypt-key.asm \ | |
581 | aes192-encrypt.asm aes192-decrypt.asm \ | |
582 | aes256-set-encrypt-key.asm aes256-set-decrypt-key.asm \ | |
583 | aes256-encrypt.asm aes256-decrypt.asm \ | |
121290e0 NM |
584 | cbc-aes128-encrypt.asm cbc-aes192-encrypt.asm \ |
585 | cbc-aes256-encrypt.asm \ | |
73bdcbe9 | 586 | camellia-crypt-internal.asm \ |
8238898d | 587 | memxor.asm memxor3.asm \ |
f79cc0c1 | 588 | ghash-set-key.asm ghash-update.asm \ |
93694133 | 589 | poly1305-internal.asm \ |
7de9a19a | 590 | chacha-core-internal.asm \ |
c8841e69 NM |
591 | salsa20-crypt.asm salsa20-core-internal.asm \ |
592 | serpent-encrypt.asm serpent-decrypt.asm \ | |
fad1bf50 | 593 | sha1-compress.asm sha256-compress-n.asm sha512-compress.asm \ |
8cf056ee | 594 | sha3-permute.asm umac-nh.asm umac-nh-n.asm machine.m4" |
e8ddf957 | 595 | |
c8841e69 | 596 | # Assembler files which generate additional object files if they are used. |
f79cc0c1 | 597 | asm_nettle_optional_list="cpuid.asm cpu-facility.asm \ |
038a108d NM |
598 | memxor-2.asm memxor3-2.asm \ |
599 | aes-encrypt-internal-2.asm aes-decrypt-internal-2.asm aes-invert-internal-2.asm \ | |
856c62ef MT |
600 | aes128-set-encrypt-key-2.asm aes128-set-decrypt-key-2.asm \ |
601 | aes128-encrypt-2.asm aes128-decrypt-2.asm \ | |
602 | aes192-set-encrypt-key-2.asm aes192-set-decrypt-key-2.asm \ | |
603 | aes192-encrypt-2.asm aes192-decrypt-2.asm \ | |
604 | aes256-set-encrypt-key-2.asm aes256-set-decrypt-key-2.asm \ | |
605 | aes256-encrypt-2.asm aes256-decrypt-2.asm \ | |
419d7af5 | 606 | cbc-aes128-encrypt-2.asm cbc-aes192-encrypt-2.asm cbc-aes256-encrypt-2.asm \ |
58a03014 | 607 | chacha-2core.asm chacha-3core.asm chacha-4core.asm chacha-core-internal-2.asm \ |
57dce2ba | 608 | poly1305-blocks.asm poly1305-internal-2.asm \ |
6b80b889 | 609 | ghash-set-key-2.asm ghash-update-2.asm \ |
9348e43a NM |
610 | gcm-aes-encrypt.asm gcm-aes-encrypt-2.asm \ |
611 | gcm-aes-decrypt.asm gcm-aes-decrypt-2.asm\ | |
58a03014 | 612 | salsa20-2core.asm salsa20-core-internal-2.asm \ |
fad1bf50 | 613 | sha1-compress-2.asm sha256-compress-n-2.asm \ |
c06fb6d4 | 614 | sha3-permute-2.asm sha512-compress-2.asm \ |
d5cb83ea NM |
615 | umac-nh-n-2.asm umac-nh-2.asm" |
616 | ||
a0ac8543 | 617 | asm_hogweed_optional_list="" |
c8841e69 | 618 | if test "x$enable_public_key" = "xyes" ; then |
abfaf8be DES |
619 | asm_hogweed_optional_list="ecc-secp192r1-modp.asm ecc-secp224r1-modp.asm \ |
620 | ecc-secp256r1-redc.asm ecc-secp384r1-modp.asm ecc-secp521r1-modp.asm \ | |
621 | ecc-curve25519-modp.asm ecc-curve448-modp.asm" | |
c8841e69 NM |
622 | fi |
623 | ||
1f0c7e6b NM |
624 | OPT_NETTLE_OBJS="" |
625 | OPT_HOGWEED_OBJS="" | |
c8841e69 | 626 | |
76182f60 | 627 | asm_file_list="" |
ccecfc93 | 628 | |
5aa8abd0 | 629 | if test "x$enable_assembler" = xyes ; then |
b15b54e5 | 630 | if test -n "$asm_path"; then |
ade7779c | 631 | AC_MSG_NOTICE([Looking for assembler files in $asm_path.]) |
c8841e69 | 632 | for tmp_f in $asm_replace_list ; do |
ade7779c NM |
633 | for asm_dir in $asm_path ; do |
634 | if test -f "$srcdir/$asm_dir/$tmp_f"; then | |
635 | asm_file_list="$asm_file_list $tmp_f" | |
636 | AC_CONFIG_LINKS($tmp_f:$asm_dir/$tmp_f) | |
637 | break | |
638 | fi | |
639 | done | |
ccecfc93 | 640 | done |
c8841e69 NM |
641 | dnl Workaround for AC_CONFIG_LINKS, which complains if we use the |
642 | dnl same destination argument $tmp_f multiple times. | |
a0ac8543 | 643 | for tmp_n in $asm_nettle_optional_list ; do |
1f0c7e6b NM |
644 | dnl Note extra pair of [] in sed expression |
645 | tmp_b=`echo "$tmp_n" | sed 's/\.[[^.]]*$//'` | |
a0ac8543 NM |
646 | for asm_dir in $asm_path ; do |
647 | if test -f "$srcdir/$asm_dir/$tmp_n"; then | |
648 | asm_file_list="$asm_file_list $tmp_n" | |
649 | AC_CONFIG_LINKS($tmp_n:$asm_dir/$tmp_n) | |
650 | while read tmp_func ; do | |
651 | AC_DEFINE_UNQUOTED(HAVE_NATIVE_$tmp_func) | |
652 | eval HAVE_NATIVE_$tmp_func=yes | |
653 | done <<EOF | |
d5cb83ea | 654 | [`sed -n 's/^.*[^ ]*PROLOGUE(_*\(nettle_\)*\([^)]*\)).*$/\2/p' < "$srcdir/$asm_dir/$tmp_n"`] |
a0ac8543 | 655 | EOF |
1f0c7e6b | 656 | OPT_NETTLE_OBJS="$OPT_NETTLE_OBJS $tmp_b"'.$(OBJEXT)' |
a0ac8543 NM |
657 | break |
658 | fi | |
659 | done | |
660 | done | |
661 | for tmp_h in $asm_hogweed_optional_list ; do | |
1f0c7e6b NM |
662 | dnl Note extra pair of [] in sed expression |
663 | tmp_b=`echo "$tmp_h" | sed 's/\.[[^.]]*$//'` | |
ade7779c | 664 | for asm_dir in $asm_path ; do |
a0ac8543 | 665 | if test -f "$srcdir/$asm_dir/$tmp_h"; then |
5ba1d4e1 NM |
666 | dnl Note double square brackets, for extra m4 quoting. |
667 | tmp_bits=`grep GMP_NUMB_BITS "$srcdir/$asm_dir/$tmp_h" \ | |
668 | | sed 's/^.*GMP_NUMB_BITS(\([[0-9]]*\)).*$/\1/'` | |
b305e440 | 669 | if test "$tmp_bits" && test "$tmp_bits" != "${NUMB_BITS}" ; then |
5ba1d4e1 NM |
670 | AC_MSG_WARN([skipping $tmp_h, because GMP_NUMB_BITS != $tmp_bits]) |
671 | continue | |
672 | fi | |
a0ac8543 NM |
673 | asm_file_list="$asm_file_list $tmp_h" |
674 | AC_CONFIG_LINKS($tmp_h:$asm_dir/$tmp_h) | |
ade7779c NM |
675 | while read tmp_func ; do |
676 | AC_DEFINE_UNQUOTED(HAVE_NATIVE_$tmp_func) | |
677 | eval HAVE_NATIVE_$tmp_func=yes | |
678 | done <<EOF | |
a0ac8543 | 679 | [`sed -n 's/[^ ]*PROLOGUE(_*\(nettle_\)*\([^)]*\)).*$/\2/p' < "$srcdir/$asm_dir/$tmp_h"`] |
c8841e69 | 680 | EOF |
1f0c7e6b | 681 | OPT_HOGWEED_OBJS="$OPT_HOGWEED_OBJS $tmp_b"'.$(OBJEXT)' |
ade7779c NM |
682 | break |
683 | fi | |
684 | done | |
c8841e69 | 685 | done |
76182f60 | 686 | if test -z "$asm_file_list"; then |
ccecfc93 NM |
687 | enable_assembler=no |
688 | AC_MSG_WARN([No assembler files found.]) | |
689 | fi | |
690 | fi | |
5c8127d4 NM |
691 | case "$host_os" in |
692 | darwin*) | |
693 | ASM_RODATA='.section __TEXT,__const' | |
694 | ;; | |
695 | *) | |
696 | ASM_RODATA='.section .rodata' | |
697 | ;; | |
698 | esac | |
ccecfc93 NM |
699 | fi |
700 | ||
1f0c7e6b NM |
701 | AC_SUBST([OPT_NETTLE_OBJS]) |
702 | AC_SUBST([OPT_HOGWEED_OBJS]) | |
9dfaebc1 | 703 | AC_SUBST([OPT_NETTLE_SOURCES]) |
2fe775ee | 704 | AC_SUBST([FAT_TEST_LIST]) |
5c8127d4 | 705 | AC_SUBST([ASM_RODATA]) |
bc702ca3 NM |
706 | if test "x$enable_assembler" = xyes ; then |
707 | IF_ASM='' | |
708 | else | |
709 | IF_ASM='#' | |
710 | fi | |
711 | AC_SUBST([IF_ASM]) | |
2e6c93ca | 712 | AC_SUBST([ASM_PPC_WANT_R_REGISTERS]) |
c8841e69 NM |
713 | |
714 | AH_VERBATIM([HAVE_NATIVE], | |
715 | [/* Define to 1 each of the following for which a native (ie. CPU specific) | |
716 | implementation of the corresponding routine exists. */ | |
b8054a1d | 717 | #undef HAVE_NATIVE_memxor3 |
f263fcf9 NM |
718 | #undef HAVE_NATIVE_aes_decrypt |
719 | #undef HAVE_NATIVE_aes_encrypt | |
038a108d | 720 | #undef HAVE_NATIVE_aes_invert |
856c62ef MT |
721 | #undef HAVE_NATIVE_aes128_decrypt |
722 | #undef HAVE_NATIVE_aes128_encrypt | |
723 | #undef HAVE_NATIVE_aes128_invert_key | |
724 | #undef HAVE_NATIVE_aes128_set_decrypt_key | |
725 | #undef HAVE_NATIVE_aes128_set_encrypt_key | |
726 | #undef HAVE_NATIVE_aes192_decrypt | |
727 | #undef HAVE_NATIVE_aes192_encrypt | |
728 | #undef HAVE_NATIVE_aes192_invert_key | |
729 | #undef HAVE_NATIVE_aes192_set_decrypt_key | |
730 | #undef HAVE_NATIVE_aes192_set_encrypt_key | |
731 | #undef HAVE_NATIVE_aes256_decrypt | |
732 | #undef HAVE_NATIVE_aes256_encrypt | |
733 | #undef HAVE_NATIVE_aes256_invert_key | |
734 | #undef HAVE_NATIVE_aes256_set_decrypt_key | |
735 | #undef HAVE_NATIVE_aes256_set_encrypt_key | |
419d7af5 NM |
736 | #undef HAVE_NATIVE_cbc_aes128_encrypt |
737 | #undef HAVE_NATIVE_cbc_aes192_encrypt | |
738 | #undef HAVE_NATIVE_cbc_aes256_encrypt | |
67bae1b9 | 739 | #undef HAVE_NATIVE_chacha_core |
c4e85975 | 740 | #undef HAVE_NATIVE_chacha_2core |
7a9d3f59 | 741 | #undef HAVE_NATIVE_chacha_3core |
58a03014 | 742 | #undef HAVE_NATIVE_chacha_4core |
87ecdf43 | 743 | #undef HAVE_NATIVE_fat_chacha_2core |
223ec90d | 744 | #undef HAVE_NATIVE_fat_chacha_3core |
58a03014 | 745 | #undef HAVE_NATIVE_fat_chacha_4core |
0a5e2524 | 746 | #undef HAVE_NATIVE_ecc_curve25519_modp |
d13bb312 | 747 | #undef HAVE_NATIVE_ecc_curve448_modp |
0a5e2524 DES |
748 | #undef HAVE_NATIVE_ecc_secp192r1_modp |
749 | #undef HAVE_NATIVE_ecc_secp192r1_redc | |
750 | #undef HAVE_NATIVE_ecc_secp224r1_modp | |
751 | #undef HAVE_NATIVE_ecc_secp224r1_redc | |
752 | #undef HAVE_NATIVE_ecc_secp256r1_modp | |
753 | #undef HAVE_NATIVE_ecc_secp256r1_redc | |
754 | #undef HAVE_NATIVE_ecc_secp384r1_modp | |
755 | #undef HAVE_NATIVE_ecc_secp384r1_redc | |
756 | #undef HAVE_NATIVE_ecc_secp521r1_modp | |
757 | #undef HAVE_NATIVE_ecc_secp521r1_redc | |
c4856c14 MT |
758 | #undef HAVE_NATIVE_poly1305_set_key |
759 | #undef HAVE_NATIVE_poly1305_block | |
760 | #undef HAVE_NATIVE_poly1305_digest | |
57dce2ba | 761 | #undef HAVE_NATIVE_poly1305_blocks |
aec77fd3 | 762 | #undef HAVE_NATIVE_fat_poly1305_blocks |
6b80b889 | 763 | #undef HAVE_NATIVE_ghash_set_key |
9939f866 | 764 | #undef HAVE_NATIVE_ghash_update |
24a8768c DT |
765 | #undef HAVE_NATIVE_gcm_aes_encrypt |
766 | #undef HAVE_NATIVE_gcm_aes_decrypt | |
d5cb83ea | 767 | #undef HAVE_NATIVE_salsa20_core |
2ac58a1c | 768 | #undef HAVE_NATIVE_salsa20_2core |
25e4316f | 769 | #undef HAVE_NATIVE_fat_salsa20_2core |
c06fb6d4 | 770 | #undef HAVE_NATIVE_sha1_compress |
fad1bf50 | 771 | #undef HAVE_NATIVE_sha256_compress_n |
d5cb83ea NM |
772 | #undef HAVE_NATIVE_sha512_compress |
773 | #undef HAVE_NATIVE_sha3_permute | |
774 | #undef HAVE_NATIVE_umac_nh | |
775 | #undef HAVE_NATIVE_umac_nh_n]) | |
c8841e69 | 776 | |
2f8497aa NM |
777 | if test "x$enable_pic" = xyes; then |
778 | LSH_CCPIC | |
779 | else | |
780 | CCPIC='' | |
781 | fi | |
782 | AC_SUBST(CCPIC) | |
4b457bbc | 783 | |
cb943f55 MS |
784 | IF_DLL='#' |
785 | LIBNETTLE_FILE_SRC='$(LIBNETTLE_FORLINK)' | |
786 | LIBHOGWEED_FILE_SRC='$(LIBHOGWEED_FORLINK)' | |
39c32d9f | 787 | EMULATOR='' |
cb943f55 | 788 | |
66681e0a | 789 | case "$host_os" in |
198e1fcb | 790 | mingw32*|cygwin*) |
cb943f55 MS |
791 | # The actual DLLs, e.g. libnettle-$major-$minor.dll, are normally |
792 | # installed into the bin dir (or more exactly $libdir/../bin, for | |
793 | # automake), while libnettle.dll.a, which is a stub file for | |
794 | # linking to the DLL, is installed into the lib dir. | |
198e1fcb MS |
795 | case "$host_os" in |
796 | mingw32*) | |
b0bf2be4 NM |
797 | LIBNETTLE_FORLINK='libnettle-$(LIBNETTLE_MAJOR).dll' |
798 | LIBHOGWEED_FORLINK='libhogweed-$(LIBHOGWEED_MAJOR).dll' | |
198e1fcb MS |
799 | ;; |
800 | cygwin*) | |
b0bf2be4 NM |
801 | LIBNETTLE_FORLINK='cygnettle-$(LIBNETTLE_MAJOR).dll' |
802 | LIBHOGWEED_FORLINK='cyghogweed-$(LIBHOGWEED_MAJOR).dll' | |
198e1fcb MS |
803 | ;; |
804 | esac | |
08b08e08 | 805 | if test "x$cross_compiling" = xyes ; then |
b8c841dc | 806 | EMULATOR=wine |
08b08e08 | 807 | fi |
7381f9c7 MS |
808 | if test "x$ABI" = x64 ; then |
809 | W64_ABI=yes | |
810 | fi | |
c40f0aa2 NM |
811 | LIBNETTLE_SONAME='' |
812 | LIBNETTLE_FILE='libnettle.dll.a' | |
cb943f55 | 813 | LIBNETTLE_FILE_SRC='$(LIBNETTLE_FILE)' |
6bc8e70c | 814 | LIBNETTLE_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBNETTLE_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive' |
c40f0aa2 NM |
815 | LIBNETTLE_LIBS='-Wl,--no-whole-archive $(LIBS)' |
816 | ||
c40f0aa2 | 817 | LIBHOGWEED_SONAME='' |
e8788330 | 818 | LIBHOGWEED_FILE='libhogweed.dll.a' |
cb943f55 | 819 | LIBHOGWEED_FILE_SRC='$(LIBHOGWEED_FILE)' |
6bc8e70c | 820 | LIBHOGWEED_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBHOGWEED_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive' |
d56aa132 | 821 | LIBHOGWEED_LIBS='-Wl,--no-whole-archive $(LIBS) libnettle.dll.a' |
cb943f55 | 822 | IF_DLL='' |
4b457bbc | 823 | ;; |
98bc3c78 | 824 | midipix*) |
825 | if test "x$ABI" = x64 ; then | |
826 | W64_ABI=yes | |
827 | fi | |
828 | LIBNETTLE_FORLINK=libnettle.so | |
829 | LIBNETTLE_SONAME='$(LIBNETTLE_FORLINK).$(LIBNETTLE_MAJOR)' | |
830 | LIBNETTLE_FILE='$(LIBNETTLE_SONAME).$(LIBNETTLE_MINOR)' | |
831 | LIBNETTLE_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,--out-dsolib=libnettle.lib.a -Wl,-soname=$(LIBNETTLE_SONAME)' | |
832 | LIBNETTLE_LIBS='' | |
833 | ||
834 | LIBHOGWEED_FORLINK=libhogweed.so | |
835 | LIBHOGWEED_SONAME='$(LIBHOGWEED_FORLINK).$(LIBHOGWEED_MAJOR)' | |
836 | LIBHOGWEED_FILE='$(LIBHOGWEED_SONAME).$(LIBHOGWEED_MINOR)' | |
837 | LIBHOGWEED_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,--out-dsolib=libhogweed.lib.a -Wl,-soname=$(LIBHOGWEED_SONAME)' | |
838 | LIBHOGWEED_LIBS='$(LIBS) .lib/libnettle.so.8' | |
839 | ;; | |
bebf371b | 840 | darwin*) |
c40f0aa2 | 841 | LIBNETTLE_FORLINK=libnettle.dylib |
69d39d67 RS |
842 | LIBNETTLE_SONAME='libnettle.$(LIBNETTLE_MAJOR).dylib' |
843 | LIBNETTLE_FILE='libnettle.$(LIBNETTLE_MAJOR).$(LIBNETTLE_MINOR).dylib' | |
6bc8e70c | 844 | LIBNETTLE_LINK='$(CC) $(CFLAGS) -dynamiclib $(LDFLAGS) -install_name ${libdir}/$(LIBNETTLE_SONAME) -compatibility_version $(LIBNETTLE_MAJOR) -current_version $(LIBNETTLE_MAJOR).$(LIBNETTLE_MINOR)' |
c40f0aa2 NM |
845 | LIBNETTLE_LIBS='' |
846 | ||
e8788330 | 847 | LIBHOGWEED_FORLINK=libhogweed.dylib |
69d39d67 RS |
848 | LIBHOGWEED_SONAME='libhogweed.$(LIBHOGWEED_MAJOR).dylib' |
849 | LIBHOGWEED_FILE='libhogweed.$(LIBHOGWEED_MAJOR).$(LIBHOGWEED_MINOR).dylib' | |
6bc8e70c | 850 | LIBHOGWEED_LINK='$(CC) $(CFLAGS) -dynamiclib -L. $(LDFLAGS) -install_name ${libdir}/$(LIBHOGWEED_SONAME) -compatibility_version $(LIBHOGWEED_MAJOR) -current_version $(LIBHOGWEED_MAJOR).$(LIBHOGWEED_MINOR)' |
2a22cbdc | 851 | LIBHOGWEED_LIBS='-lnettle $(LIBS)' |
bebf371b | 852 | ;; |
3ab6b33c DM |
853 | solaris*) |
854 | # Sun's ld uses -h to set the soname, and this option is passed | |
855 | # through by both Sun's compiler and gcc. Might not work with GNU | |
856 | # ld, but it's unusual to use GNU ld on Solaris. | |
857 | LIBNETTLE_FORLINK=libnettle.so | |
858 | LIBNETTLE_SONAME='$(LIBNETTLE_FORLINK).$(LIBNETTLE_MAJOR)' | |
859 | LIBNETTLE_FILE='$(LIBNETTLE_SONAME).$(LIBNETTLE_MINOR)' | |
a896feb0 | 860 | LIBNETTLE_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -h $(LIBNETTLE_SONAME)' |
3ab6b33c DM |
861 | LIBNETTLE_LIBS='' |
862 | ||
863 | LIBHOGWEED_FORLINK=libhogweed.so | |
864 | LIBHOGWEED_SONAME='$(LIBHOGWEED_FORLINK).$(LIBHOGWEED_MAJOR)' | |
865 | LIBHOGWEED_FILE='$(LIBHOGWEED_SONAME).$(LIBHOGWEED_MINOR)' | |
a896feb0 | 866 | LIBHOGWEED_LINK='$(CC) $(CFLAGS) $(LDFLAGS) --shared -h $(LIBHOGWEED_SONAME)' |
2a22cbdc | 867 | LIBHOGWEED_LIBS='libnettle.so $(LIBS)' |
3ab6b33c | 868 | ;; |
4b457bbc | 869 | *) |
c40f0aa2 NM |
870 | LIBNETTLE_FORLINK=libnettle.so |
871 | LIBNETTLE_SONAME='$(LIBNETTLE_FORLINK).$(LIBNETTLE_MAJOR)' | |
872 | LIBNETTLE_FILE='$(LIBNETTLE_SONAME).$(LIBNETTLE_MINOR)' | |
6bc8e70c | 873 | LIBNETTLE_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname=$(LIBNETTLE_SONAME)' |
c40f0aa2 NM |
874 | LIBNETTLE_LIBS='' |
875 | ||
e8788330 | 876 | LIBHOGWEED_FORLINK=libhogweed.so |
c40f0aa2 NM |
877 | LIBHOGWEED_SONAME='$(LIBHOGWEED_FORLINK).$(LIBHOGWEED_MAJOR)' |
878 | LIBHOGWEED_FILE='$(LIBHOGWEED_SONAME).$(LIBHOGWEED_MINOR)' | |
03b633b4 | 879 | LIBHOGWEED_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname=$(LIBHOGWEED_SONAME)' |
fc0ca95a NM |
880 | # Requested by debian, to make linking with only -lhogweed work |
881 | # (does not work in general, e.g., with static linking all of | |
882 | # -lhogweed -lgmp -lnettle are still required). Also makes dlopen | |
883 | # of libhogweed.so work, without having to use RTLD_GLOBAL. | |
2a22cbdc | 884 | LIBHOGWEED_LIBS='libnettle.so $(LIBS)' |
4b457bbc NM |
885 | ;; |
886 | esac | |
a9981290 | 887 | |
1b1a4447 | 888 | ASM_SYMBOL_PREFIX='' |
768bcd1d | 889 | ASM_ELF_STYLE='no' |
1851417e | 890 | ASM_COFF_STYLE='no' |
d56b4410 NM |
891 | # GNU as default is to use @ |
892 | ASM_TYPE_FUNCTION='@function' | |
893 | ASM_TYPE_PROGBITS='@progbits' | |
9ef0694c | 894 | ASM_MARK_NOEXEC_STACK='' |
82ffd6f8 | 895 | ASM_ALIGN_LOG='' |
1b1a4447 NM |
896 | |
897 | if test x$enable_assembler = xyes ; then | |
898 | AC_CACHE_CHECK([if globals are prefixed by underscore], | |
899 | nettle_cv_asm_underscore, | |
900 | [ # Default is no underscore | |
901 | nettle_cv_asm_underscore=no | |
902 | AC_COMPILE_IFELSE( | |
8d06f29e | 903 | [AC_LANG_SOURCE([int a_global_symbol;])], |
768bcd1d | 904 | [ $NM conftest.$OBJEXT >conftest.out |
1b1a4447 NM |
905 | if grep _a_global_symbol conftest.out >/dev/null ; then |
906 | nettle_cv_asm_underscore=yes | |
907 | elif grep a_global_symbol conftest.out >/dev/null ; then | |
908 | nettle_cv_asm_underscore=no | |
909 | else | |
25dd7f46 | 910 | AC_MSG_WARN([nm does not list a_global_symbol at all]) |
1b1a4447 NM |
911 | fi], |
912 | [AC_MSG_WARN([test program with a single global could not be compiled!?])])]) | |
8c226056 | 913 | if test x$nettle_cv_asm_underscore = xyes ; then |
1b1a4447 | 914 | ASM_SYMBOL_PREFIX='_' |
768bcd1d | 915 | fi |
9ef0694c | 916 | |
f8231569 NM |
917 | AC_CACHE_CHECK([for ELF-style .type,%function pseudo-ops], |
918 | [nettle_cv_asm_type_percent_function], | |
919 | [GMP_TRY_ASSEMBLE([ | |
768bcd1d NM |
920 | .text |
921 | .globl foo | |
f8231569 | 922 | .type foo,%function |
768bcd1d NM |
923 | foo: |
924 | .Lend: | |
925 | ||
926 | .size foo, .Lend - foo | |
f8231569 NM |
927 | ], |
928 | [nettle_cv_asm_type_percent_function=yes], | |
929 | [nettle_cv_asm_type_percent_function=no])]) | |
930 | ||
931 | dnl Needs double quote for the # character | |
932 | AC_CACHE_CHECK([[for ELF-style .type,#function pseudo-ops]], | |
933 | [nettle_cv_asm_type_hash_function], | |
934 | [GMP_TRY_ASSEMBLE([ | |
935 | .text | |
936 | .globl foo | |
937 | .type foo,#function | |
938 | foo: | |
939 | .Lend: | |
940 | ||
941 | .size foo, .Lend - foo | |
942 | ], | |
943 | [nettle_cv_asm_type_hash_function=yes], | |
944 | [nettle_cv_asm_type_hash_function=no])]) | |
945 | ||
946 | if test x$nettle_cv_asm_type_percent_function = xyes ; then | |
768bcd1d | 947 | ASM_ELF_STYLE='yes' |
f8231569 | 948 | ASM_TYPE_FUNCTION='%function' |
d56b4410 | 949 | ASM_TYPE_PROGBITS='%progbits' |
f8231569 NM |
950 | else |
951 | if test x$nettle_cv_asm_type_hash_function = xyes ; then | |
952 | ASM_ELF_STYLE='yes' | |
953 | ASM_TYPE_FUNCTION='#function' | |
d56b4410 | 954 | ASM_TYPE_PROGBITS='#progbits' |
f8231569 | 955 | fi |
768bcd1d | 956 | fi |
d56b4410 | 957 | |
1851417e NM |
958 | AC_CACHE_CHECK([for COFF-style .type directive], |
959 | [nettle_cv_asm_coff_type], | |
960 | [GMP_TRY_ASSEMBLE([ | |
961 | .text | |
962 | .globl _foo | |
963 | .def _foo | |
964 | .scl 2 | |
965 | .type 32 | |
966 | .endef | |
967 | _foo: | |
968 | ], | |
969 | [nettle_cv_asm_coff_type=yes], | |
970 | [nettle_cv_asm_coff_type=no])]) | |
971 | if test "x$nettle_cv_asm_coff_type" = "xyes" ; then | |
972 | ASM_COFF_STYLE=yes | |
973 | fi | |
974 | ||
d56b4410 NM |
975 | AC_CACHE_CHECK([if we should use a .note.GNU-stack section], |
976 | nettle_cv_asm_gnu_stack, | |
977 | [ # Default | |
978 | nettle_cv_asm_gnu_stack=no | |
979 | ||
980 | cat >conftest.c <<EOF | |
981 | int foo() { return 0; } | |
982 | EOF | |
983 | nettle_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >conftest.out 2>&1" | |
984 | if AC_TRY_EVAL(nettle_compile); then | |
95fa09b7 | 985 | cat conftest.out >&AS_MESSAGE_LOG_FD |
d56b4410 NM |
986 | $OBJDUMP -x conftest.o | grep '\.note\.GNU-stack' > /dev/null \ |
987 | && nettle_cv_asm_gnu_stack=yes | |
988 | else | |
95fa09b7 NM |
989 | cat conftest.out >&AS_MESSAGE_LOG_FD |
990 | echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD | |
991 | cat conftest.s >&AS_MESSAGE_LOG_FD | |
d56b4410 NM |
992 | fi |
993 | rm -f conftest.*]) | |
994 | if test x$nettle_cv_asm_gnu_stack = xyes ; then | |
995 | ASM_MARK_NOEXEC_STACK='.section .note.GNU-stack,"",TYPE_PROGBITS' | |
996 | fi | |
997 | ||
82ffd6f8 NM |
998 | AC_CACHE_CHECK([if .align assembly directive is logarithmic], |
999 | [nettle_cv_asm_align_log], | |
1000 | [GMP_TRY_ASSEMBLE([ | |
1001 | .align 3 | |
1002 | ], | |
1003 | [nettle_cv_asm_align_log=yes], | |
1004 | [nettle_cv_asm_align_log=no])]) | |
71e778e3 | 1005 | ASM_ALIGN_LOG="$nettle_cv_asm_align_log" |
1b1a4447 NM |
1006 | fi |
1007 | ||
99118f50 L |
1008 | dnl Define |
1009 | dnl 1. ASM_X86_ENDBR for endbr32/endbr64. | |
1010 | dnl 2. ASM_X86_MARK_CET to add a .note.gnu.property section to mark | |
1011 | dnl Intel CET support if needed. | |
1012 | dnl 3. ASM_X86_MARK_CET_ALIGN to align ASM_X86_MARK_CET. | |
1013 | AC_CACHE_CHECK([if Intel CET is enabled], | |
1014 | [nettle_cv_asm_x86_intel_cet], | |
95fa09b7 | 1015 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
99118f50 L |
1016 | #ifndef __CET__ |
1017 | #error Intel CET is not enabled | |
1018 | #endif | |
95fa09b7 | 1019 | ]], [[]])], |
99118f50 L |
1020 | [nettle_cv_asm_x86_intel_cet=yes], |
1021 | [nettle_cv_asm_x86_intel_cet=no])]) | |
1022 | if test "$nettle_cv_asm_x86_intel_cet" = yes; then | |
1023 | case $ABI in | |
1024 | 32|standard) | |
1025 | ASM_X86_ENDBR=endbr32 | |
1026 | ASM_X86_MARK_CET_ALIGN=2 | |
1027 | ;; | |
1028 | 64) | |
1029 | ASM_X86_ENDBR=endbr64 | |
1030 | ASM_X86_MARK_CET_ALIGN=3 | |
1031 | ;; | |
1032 | x32) | |
1033 | ASM_X86_ENDBR=endbr64 | |
1034 | ASM_X86_MARK_CET_ALIGN=2 | |
1035 | ;; | |
1036 | esac | |
1037 | AC_CACHE_CHECK([if .note.gnu.property section is needed], | |
1038 | [nettle_cv_asm_x86_gnu_property], | |
95fa09b7 | 1039 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
99118f50 L |
1040 | #if !defined __ELF__ || !defined __CET__ |
1041 | #error GNU property is not needed | |
1042 | #endif | |
95fa09b7 NM |
1043 | ]], [[]])], |
1044 | [nettle_cv_asm_x86_gnu_property=yes], | |
1045 | [nettle_cv_asm_x86_gnu_property=no])]) | |
99118f50 L |
1046 | else |
1047 | nettle_cv_asm_x86_gnu_property=no | |
1048 | fi | |
1049 | if test "$nettle_cv_asm_x86_gnu_property" = yes; then | |
1050 | ASM_X86_MARK_CET=' | |
1051 | .pushsection ".note.gnu.property", "a" | |
1052 | .p2align ASM_X86_MARK_CET_ALIGN | |
1053 | .long 1f - 0f | |
1054 | .long 4f - 1f | |
1055 | .long 5 | |
1056 | 0: | |
1057 | .asciz "GNU" | |
1058 | 1: | |
1059 | .p2align ASM_X86_MARK_CET_ALIGN | |
1060 | .long 0xc0000002 | |
1061 | .long 3f - 2f | |
1062 | 2: | |
1063 | .long 3 | |
1064 | 3: | |
1065 | .p2align ASM_X86_MARK_CET_ALIGN | |
1066 | 4: | |
1067 | .popsection' | |
1068 | fi | |
1069 | ||
1b1a4447 | 1070 | AC_SUBST(ASM_SYMBOL_PREFIX) |
768bcd1d | 1071 | AC_SUBST(ASM_ELF_STYLE) |
1851417e | 1072 | AC_SUBST(ASM_COFF_STYLE) |
f8231569 | 1073 | AC_SUBST(ASM_TYPE_FUNCTION) |
d56b4410 | 1074 | AC_SUBST(ASM_TYPE_PROGBITS) |
9ef0694c | 1075 | AC_SUBST(ASM_MARK_NOEXEC_STACK) |
82ffd6f8 | 1076 | AC_SUBST(ASM_ALIGN_LOG) |
c7cf1939 | 1077 | AC_SUBST(ELFV2_ABI) |
7381f9c7 | 1078 | AC_SUBST(W64_ABI) |
d5738a57 | 1079 | AC_SUBST(ASM_WORDS_BIGENDIAN) |
39c32d9f | 1080 | AC_SUBST(EMULATOR) |
99118f50 L |
1081 | AC_SUBST(ASM_X86_ENDBR) |
1082 | AC_SUBST(ASM_X86_MARK_CET) | |
1083 | AC_SUBST(ASM_X86_MARK_CET_ALIGN) | |
0780589e | 1084 | |
c40f0aa2 NM |
1085 | AC_SUBST(LIBNETTLE_MAJOR) |
1086 | AC_SUBST(LIBNETTLE_MINOR) | |
1087 | AC_SUBST(LIBNETTLE_FORLINK) | |
1088 | AC_SUBST(LIBNETTLE_SONAME) | |
1089 | AC_SUBST(LIBNETTLE_FILE) | |
cb943f55 | 1090 | AC_SUBST(LIBNETTLE_FILE_SRC) |
c40f0aa2 NM |
1091 | AC_SUBST(LIBNETTLE_LINK) |
1092 | AC_SUBST(LIBNETTLE_LIBS) | |
1093 | ||
274df193 NM |
1094 | AC_SUBST(LIBHOGWEED_MAJOR) |
1095 | AC_SUBST(LIBHOGWEED_MINOR) | |
1096 | AC_SUBST(LIBHOGWEED_FORLINK) | |
1097 | AC_SUBST(LIBHOGWEED_SONAME) | |
1098 | AC_SUBST(LIBHOGWEED_FILE) | |
cb943f55 | 1099 | AC_SUBST(LIBHOGWEED_FILE_SRC) |
274df193 NM |
1100 | AC_SUBST(LIBHOGWEED_LINK) |
1101 | AC_SUBST(LIBHOGWEED_LIBS) | |
3591eb53 | 1102 | |
8ae5b576 | 1103 | AC_PATH_PROG(M4, m4, m4) |
2ed0c4b5 | 1104 | |
c40f0aa2 NM |
1105 | AH_TEMPLATE([WITH_HOGWEED], [Defined if public key features are enabled]) |
1106 | ||
5aa8abd0 | 1107 | if test "x$enable_public_key" = xyes ; then |
c40f0aa2 NM |
1108 | AC_DEFINE(WITH_HOGWEED) |
1109 | IF_HOGWEED='' | |
1110 | else | |
1111 | IF_HOGWEED='#' | |
1112 | fi | |
1113 | ||
b8e111bd NM |
1114 | if test "x$enable_static" = xyes ; then |
1115 | IF_STATIC='' | |
1116 | else | |
1117 | IF_STATIC='#' | |
1118 | fi | |
1119 | ||
7123800a | 1120 | IF_DLOPEN_TEST='#' |
c40f0aa2 NM |
1121 | if test "x$enable_shared" = xyes ; then |
1122 | IF_SHARED='' | |
c8b1d2fa | 1123 | IF_NOT_SHARED='#' |
e1f2fa29 | 1124 | if test "x$ac_cv_lib_dl_dlopen" = xyes ; then |
7123800a NM |
1125 | IF_DLOPEN_TEST='' |
1126 | fi | |
a66628b1 | 1127 | else |
c40f0aa2 | 1128 | IF_SHARED='#' |
c8b1d2fa | 1129 | IF_NOT_SHARED='' |
5aa8abd0 NM |
1130 | fi |
1131 | ||
244588a4 ST |
1132 | # Documentation tools |
1133 | if test "x$enable_documentation" != "xno"; then | |
1134 | AC_PATH_PROG(MAKEINFO, makeinfo, not-found) | |
1135 | ||
1136 | if test "x$MAKEINFO" != "xnot-found"; then | |
1137 | enable_documentation=yes | |
1138 | AC_SUBST(MAKEINFO) | |
1139 | else | |
1140 | if test "x$enable_documentation" == "xauto" ; then | |
1141 | enable_documentation=no | |
1142 | else | |
1143 | AC_MSG_ERROR([Cannot find 'makeinfo', required for documentation.]) | |
1144 | fi | |
1145 | fi | |
1146 | fi | |
1147 | ||
1148 | if test "x$enable_documentation" = "xyes" ; then | |
1149 | IF_DOCUMENTATION='' | |
1150 | else | |
1151 | IF_DOCUMENTATION='#' | |
1152 | fi | |
1153 | ||
2a22cbdc NM |
1154 | if test "x$enable_mini_gmp" = "xyes" ; then |
1155 | IF_MINI_GMP='' | |
1156 | else | |
1157 | IF_MINI_GMP='#' | |
1158 | fi | |
1159 | ||
c40f0aa2 | 1160 | AC_SUBST(IF_HOGWEED) |
b8e111bd | 1161 | AC_SUBST(IF_STATIC) |
c40f0aa2 | 1162 | AC_SUBST(IF_SHARED) |
c8b1d2fa | 1163 | AC_SUBST(IF_NOT_SHARED) |
7123800a | 1164 | AC_SUBST(IF_DLOPEN_TEST) |
244588a4 | 1165 | AC_SUBST(IF_DOCUMENTATION) |
cb943f55 | 1166 | AC_SUBST(IF_DLL) |
2a22cbdc | 1167 | AC_SUBST(IF_MINI_GMP) |
4bbf08c3 | 1168 | |
e4a659e4 NM |
1169 | OPENSSL_LIBFLAGS='' |
1170 | ||
2f0327a1 | 1171 | # Check for openssl's libcrypto (used only for benchmarking) |
c2098091 | 1172 | if test x$enable_openssl = xyes ; then |
2f0327a1 NM |
1173 | AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_new, |
1174 | [OPENSSL_LIBFLAGS='-lcrypto'], | |
1175 | [enable_openssl=no]) | |
c2098091 | 1176 | fi |
c2098091 | 1177 | if test x$enable_openssl = xyes ; then |
2f0327a1 NM |
1178 | AC_MSG_CHECKING([if openssl supports the functions used by nettle benchmark programs]) |
1179 | save_LIBS="$LIBS" | |
1180 | LIBS="$LIBS $OPENSSL_LIBFLAGS" | |
1181 | AC_LINK_IFELSE([AC_LANG_PROGRAM([ | |
1182 | #include <openssl/evp.h> | |
1183 | #include <openssl/ec.h> | |
1184 | #include <openssl/rsa.h> | |
1185 | ], [ | |
1186 | EVP_MD_CTX *cipher_ctx = EVP_CIPHER_CTX_new(); | |
1187 | EVP_MD_CTX *md_ctx = EVP_MD_CTX_new(); | |
1188 | EVP_PKEY *rsa_key = EVP_RSA_gen(2048); | |
1189 | EVP_PKEY *ec_key = EVP_EC_gen("P-256"); | |
1190 | int res = EVP_DigestSignFinal (md_ctx, NULL, NULL); | |
1191 | ])], [ | |
1192 | AC_MSG_RESULT([yes]) | |
1193 | AC_DEFINE([WITH_OPENSSL], 1, | |
1194 | [Define if you have openssl libcrypto (used for benchmarking)]) | |
1195 | ], [ | |
1196 | AC_MSG_RESULT([no]) | |
1197 | enable_openssl=no | |
1198 | ]) | |
1199 | LIBS=$save_LIBS | |
c2098091 | 1200 | fi |
e4a659e4 NM |
1201 | |
1202 | AC_SUBST(OPENSSL_LIBFLAGS) | |
986161a0 | 1203 | |
19c13e25 | 1204 | AH_BOTTOM( |
788ba4ab NM |
1205 | [#if defined(__x86_64__) || defined(__arch64__) |
1206 | # define HAVE_NATIVE_64_BIT 1 | |
1207 | #else | |
1208 | /* Needs include of <limits.h> before use. */ | |
1209 | # define HAVE_NATIVE_64_BIT (SIZEOF_LONG * CHAR_BIT >= 64) | |
1210 | #endif | |
19c13e25 NM |
1211 | ]) |
1212 | ||
cfab908f NM |
1213 | # clock_gettime is in librt on *-*-osf5.1 and on glibc, so add -lrt to |
1214 | # BENCH_LIBS if needed. On linux (tested on x86_32, 2.6.26), | |
1215 | # clock_getres reports ns accuracy, while in a quick test on osf | |
1216 | # clock_getres said only 1 millisecond. | |
1217 | ||
1218 | old_LIBS="$LIBS" | |
1219 | AC_SEARCH_LIBS(clock_gettime, rt, [ | |
8a251bc9 | 1220 | AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define if clock_gettime is available])]) |
cfab908f NM |
1221 | BENCH_LIBS="$LIBS" |
1222 | LIBS="$old_LIBS" | |
1223 | ||
1224 | AC_SUBST(BENCH_LIBS) | |
1225 | ||
8ae5b576 NM |
1226 | # Set these flags *last*, or else the test programs won't compile |
1227 | if test x$GCC = xyes ; then | |
228ae261 | 1228 | CFLAGS="$CFLAGS -ggdb3 -Wall -W -Wno-sign-compare \ |
befd90d2 NM |
1229 | -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \ |
1230 | -Wpointer-arith -Wbad-function-cast -Wnested-externs" | |
8ae5b576 NM |
1231 | |
1232 | # Don't enable -Wcast-align as it results in tons of warnings in the | |
1233 | # DES code. And when using stdio. | |
67a88657 NM |
1234 | # Don't enable -Waggregate-return, as that causes warnings for glibc |
1235 | # inttypes.h. | |
8ae5b576 | 1236 | fi |
94cb1bf0 | 1237 | |
81b2bce2 | 1238 | AC_CONFIG_FILES([config.make config.m4 Makefile version.h]) |
987e6dc0 | 1239 | AC_CONFIG_FILES([tools/Makefile testsuite/Makefile examples/Makefile]) |
d1c1ebd9 | 1240 | AC_CONFIG_FILES([nettle.pc hogweed.pc libnettle.map libhogweed.map]) |
987e6dc0 NM |
1241 | |
1242 | AC_OUTPUT | |
2ed0c4b5 | 1243 | |
1eed358e NM |
1244 | AC_MSG_NOTICE([summary of build options: |
1245 | ||
1246 | Version: ${PACKAGE_STRING} | |
1247 | Host type: ${host} | |
1248 | ABI: ${ABI} | |
1249 | Assembly files: ${asm_path:-none} | |
1250 | Install prefix: ${prefix} | |
1251 | Library directory: ${libdir} | |
1252 | Compiler: ${CC} | |
b8e111bd | 1253 | Static libraries: ${enable_static} |
1eed358e NM |
1254 | Shared libraries: ${enable_shared} |
1255 | Public key crypto: ${enable_public_key} | |
2a22cbdc | 1256 | Using mini-gmp: ${enable_mini_gmp} |
244588a4 | 1257 | Documentation: ${enable_documentation} |
1eed358e | 1258 | ]) |