1 # Configure.ac script for Libgcrypt
2 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006,
3 # 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
4 # Copyright (C) 2012, 2013, 2014, 2015, 2016 g10 Code GmbH
6 # This file is part of Libgcrypt.
8 # Libgcrypt is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Lesser General Public License as
10 # published by the Free Software Foundation; either version 2.1 of
11 # the License, or (at your option) any later version.
13 # Libgcrypt is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this program; if not, see <http://www.gnu.org/licenses/>.
21 # (Process this file with autoconf to produce a configure script.)
22 AC_REVISION($Revision$)
24 min_automake_version="1.14"
26 # To build a release you need to create a tag with the version number
27 # (git tag -s libgcrypt-n.m.k) and run "./autogen.sh --force". Please
28 # bump the version number immediately after the release and do another
29 # commit and push so that the git magic is able to work. See below
30 # for the LT versions.
31 m4_define(mym4_version_major, [1])
32 m4_define(mym4_version_minor, [8])
33 m4_define(mym4_version_micro, [0])
35 # Below is m4 magic to extract and compute the revision number, the
36 # decimalized short revision number, a beta version string, and a flag
37 # indicating a development version (mym4_isgit). Note that the m4
38 # processing is done by autoconf and not during the configure run.
39 m4_define(mym4_version,
40 [mym4_version_major.mym4_version_minor.mym4_version_micro])
41 m4_define([mym4_revision],
42 m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
43 m4_define([mym4_revision_dec],
44 m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
45 m4_define([mym4_betastring],
46 m4_esyscmd_s([git describe --match 'libgcrypt-[0-9].*[0-9]' --long|\
47 awk -F- '$3!=0{print"-beta"$3}']))
48 m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
49 m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
51 AC_INIT([libgcrypt],[mym4_full_version],[http://bugs.gnupg.org])
53 # LT Version numbers, remember to change them just *before* a release.
54 # (Interfaces removed: CURRENT++, AGE=0, REVISION=0)
55 # (Interfaces added: CURRENT++, AGE++, REVISION=0)
56 # (No interfaces changed: REVISION++)
57 LIBGCRYPT_LT_CURRENT=21
59 LIBGCRYPT_LT_REVISION=3
62 # If the API is changed in an incompatible way: increment the next counter.
64 # 1.6: ABI and API change but the change is to most users irrelevant
65 # and thus the API version number has not been incremented.
66 LIBGCRYPT_CONFIG_API_VERSION=1
68 # If you change the required gpg-error version, please remove
69 # unnecessary error code defines in src/gcrypt-int.h.
70 NEED_GPG_ERROR_VERSION=1.25
73 VERSION=$PACKAGE_VERSION
75 AC_CONFIG_AUX_DIR([build-aux])
76 AC_CONFIG_SRCDIR([src/libgcrypt.vers])
77 AM_INIT_AUTOMAKE([serial-tests dist-bzip2])
78 AC_CONFIG_HEADER(config.h)
79 AC_CONFIG_MACRO_DIR([m4])
80 AC_CONFIG_LIBOBJ_DIR([compat])
85 AC_ARG_VAR(SYSROOT,[locate config scripts also below that directory])
88 #ifndef _GCRYPT_CONFIG_H_INCLUDED
89 #define _GCRYPT_CONFIG_H_INCLUDED
91 /* Enable gpg-error's strerror macro for W32CE. */
92 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
96 #define _GCRYPT_IN_LIBGCRYPT 1
98 /* If the configure check for endianness has been disabled, get it from
99 OS macros. This is intended for making fat binary builds on OS X. */
100 #ifdef DISABLED_ENDIAN_CHECK
101 # if defined(__BIG_ENDIAN__)
102 # define WORDS_BIGENDIAN 1
103 # elif defined(__LITTLE_ENDIAN__)
104 # undef WORDS_BIGENDIAN
106 # error "No endianness found"
108 #endif /*DISABLED_ENDIAN_CHECK*/
110 /* We basically use the original Camellia source. Make sure the symbols
111 properly prefixed. */
112 #define CAMELLIA_EXT_SYM_PREFIX _gcry_
114 #endif /*_GCRYPT_CONFIG_H_INCLUDED*/
117 AH_VERBATIM([_REENTRANT],
118 [/* To allow the use of Libgcrypt in multithreaded programs we have to use
119 special features from the library. */
121 # define _REENTRANT 1
126 AC_SUBST(LIBGCRYPT_LT_CURRENT)
127 AC_SUBST(LIBGCRYPT_LT_AGE)
128 AC_SUBST(LIBGCRYPT_LT_REVISION)
131 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
132 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
133 VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \
134 mym4_version_minor mym4_version_micro)
135 AC_SUBST(VERSION_NUMBER)
138 ######################
139 ## Basic checks. ### (we need some results later on (e.g. $GCC)
140 ######################
143 missing_dir=`cd $ac_aux_dir && pwd`
144 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
145 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
146 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
147 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
148 # AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
159 # We need to compile and run a program on the build machine. A
160 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
161 # the AC archive is broken for autoconf 2.57. Given that there is no
162 # newer version of that macro, we assume that it is also broken for
163 # autoconf 2.61 and thus we use a simple but usually sufficient
165 AC_MSG_CHECKING(for cc for build)
166 if test "$cross_compiling" = "yes"; then
167 CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
169 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
171 AC_MSG_RESULT($CC_FOR_BUILD)
172 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
176 LT_INIT([win32-dll disable-static])
177 LT_LANG([Windows Resource])
180 ##########################
181 ## General definitions. ##
182 ##########################
184 # Used by libgcrypt-config
185 LIBGCRYPT_CONFIG_LIBS="-lgcrypt"
186 LIBGCRYPT_CONFIG_CFLAGS=""
187 LIBGCRYPT_CONFIG_HOST="$host"
189 # Definitions for symmetric ciphers.
190 available_ciphers="arcfour blowfish cast5 des aes twofish serpent rfc2268 seed"
191 available_ciphers="$available_ciphers camellia idea salsa20 gost28147 chacha20"
194 # Definitions for public-key ciphers.
195 available_pubkey_ciphers="dsa elgamal rsa ecc"
196 enabled_pubkey_ciphers=""
198 # Definitions for message digests.
199 available_digests="crc gostr3411-94 md2 md4 md5 rmd160 sha1 sha256"
200 available_digests="$available_digests sha512 sha3 tiger whirlpool stribog"
203 # Definitions for kdfs (optional ones)
204 available_kdfs="s2k pkdf2 scrypt"
207 # Definitions for random modules.
208 available_random_modules="linux egd unix"
209 auto_random_modules="$available_random_modules"
211 # Supported thread backends.
212 LIBGCRYPT_THREAD_MODULES=""
221 # Setup some stuff depending on host.
224 ac_cv_have_dev_random=no
228 have_w32ce_system=yes
229 available_random_modules="w32ce"
232 available_random_modules="w32"
235 AC_DEFINE(USE_ONLY_8DOT3,1,
236 [set this to limit filenames to the 8.3 format])
237 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
238 [defined if we must run on a stupid file system])
239 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
240 [defined if we run on some of the PCDOS like systems
241 (DOS, Windoze. OS/2) with special properties like
245 i?86-emx-os2 | i?86-*-os2*emx)
246 # OS/2 with the EMX environment
247 ac_cv_have_dev_random=no
248 AC_DEFINE(HAVE_DRIVE_LETTERS)
249 AC_DEFINE(HAVE_DOSISH_SYSTEM)
253 # DOS with the DJGPP environment
254 ac_cv_have_dev_random=no
255 AC_DEFINE(HAVE_DRIVE_LETTERS)
256 AC_DEFINE(HAVE_DOSISH_SYSTEM)
260 if test -z "$GCC" ; then
261 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
265 if test -z "$GCC" ; then
266 # Suppress all warnings
267 # to get rid of the unsigned/signed char mismatch warnings.
277 if test "$have_w32_system" = yes; then
278 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
279 if test "$have_w32ce_system" = yes; then
280 AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
283 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
284 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
288 # A printable OS Name is sometimes useful.
291 PRINTABLE_OS_NAME="W32CE"
295 PRINTABLE_OS_NAME="W32"
298 i?86-emx-os2 | i?86-*-os2*emx )
299 PRINTABLE_OS_NAME="OS/2"
303 PRINTABLE_OS_NAME="MSDOS/DJGPP"
307 PRINTABLE_OS_NAME="GNU/Linux"
311 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
316 # Figure out the name of the random device
320 NAME_OF_DEV_RANDOM="/dev/srandom"
321 NAME_OF_DEV_URANDOM="/dev/urandom"
325 NAME_OF_DEV_RANDOM="/dev/random"
326 NAME_OF_DEV_URANDOM="/dev/urandom"
331 AC_ARG_ENABLE(endian-check,
332 AC_HELP_STRING([--disable-endian-check],
333 [disable the endian check and trust the OS provided macros]),
334 endiancheck=$enableval,endiancheck=yes)
335 if test x"$endiancheck" = xyes ; then
338 AC_DEFINE(DISABLED_ENDIAN_CHECK,1,[configure did not test for endianess])
341 AC_CHECK_SIZEOF(unsigned short, 2)
342 AC_CHECK_SIZEOF(unsigned int, 4)
343 AC_CHECK_SIZEOF(unsigned long, 4)
344 AC_CHECK_SIZEOF(unsigned long long, 0)
345 AC_CHECK_SIZEOF(void *, 0)
349 if test "$ac_cv_sizeof_unsigned_short" = "0" \
350 || test "$ac_cv_sizeof_unsigned_int" = "0" \
351 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
352 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
355 # Ensure that we have UINT64_C before we bother to check for uint64_t
356 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
357 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <inttypes.h>]],
358 [[uint64_t foo=UINT64_C(42);]])],
359 gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
360 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
361 AC_CHECK_SIZEOF(uint64_t)
364 # Do we have any 64-bit data types?
365 if test "$ac_cv_sizeof_unsigned_int" != "8" \
366 && test "$ac_cv_sizeof_unsigned_long" != "8" \
367 && test "$ac_cv_sizeof_unsigned_long_long" != "8" \
368 && test "$ac_cv_sizeof_uint64_t" != "8"; then
371 *** No 64-bit integer type available.
372 *** It is not possible to build Libgcrypt on this platform.
377 # If not specified otherwise, all available algorithms will be
379 default_ciphers="$available_ciphers"
380 default_pubkey_ciphers="$available_pubkey_ciphers"
381 default_digests="$available_digests"
382 default_kdfs="$available_kdfs"
383 # Blacklist MD2 by default
384 default_digests=`echo $default_digests | sed -e 's/md2//g'`
386 # Substitutions to set generated files in a Emacs buffer to read-only.
387 AC_SUBST(emacs_local_vars_begin, ['Local Variables:'])
388 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
389 AC_SUBST(emacs_local_vars_end, ['End:'])
391 ############################
392 ## Command line switches. ##
393 ############################
395 # Implementation of the --enable-ciphers switch.
396 AC_ARG_ENABLE(ciphers,
397 AC_HELP_STRING([--enable-ciphers=ciphers],
398 [select the symmetric ciphers to include]),
399 [enabled_ciphers=`echo $enableval | tr ',:' ' ' | tr '[A-Z]' '[a-z]'`],
400 [enabled_ciphers=""])
401 if test "x$enabled_ciphers" = "x" \
402 -o "$enabled_ciphers" = "yes" \
403 -o "$enabled_ciphers" = "no"; then
404 enabled_ciphers=$default_ciphers
406 AC_MSG_CHECKING([which symmetric ciphers to include])
407 for cipher in $enabled_ciphers; do
408 LIST_MEMBER($cipher, $available_ciphers)
409 if test "$found" = "0"; then
410 AC_MSG_ERROR([unsupported cipher "$cipher" specified])
413 AC_MSG_RESULT([$enabled_ciphers])
415 # Implementation of the --enable-pubkey-ciphers switch.
416 AC_ARG_ENABLE(pubkey-ciphers,
417 AC_HELP_STRING([--enable-pubkey-ciphers=ciphers],
418 [select the public-key ciphers to include]),
419 [enabled_pubkey_ciphers=`echo $enableval | tr ',:' ' ' | tr '[A-Z]' '[a-z]'`],
420 [enabled_pubkey_ciphers=""])
421 if test "x$enabled_pubkey_ciphers" = "x" \
422 -o "$enabled_pubkey_ciphers" = "yes" \
423 -o "$enabled_pubkey_ciphers" = "no"; then
424 enabled_pubkey_ciphers=$default_pubkey_ciphers
426 AC_MSG_CHECKING([which public-key ciphers to include])
427 for cipher in $enabled_pubkey_ciphers; do
428 LIST_MEMBER($cipher, $available_pubkey_ciphers)
429 if test "$found" = "0"; then
430 AC_MSG_ERROR([unsupported public-key cipher specified])
433 AC_MSG_RESULT([$enabled_pubkey_ciphers])
435 # Implementation of the --enable-digests switch.
436 AC_ARG_ENABLE(digests,
437 AC_HELP_STRING([--enable-digests=digests],
438 [select the message digests to include]),
439 [enabled_digests=`echo $enableval | tr ',:' ' ' | tr '[A-Z]' '[a-z]'`],
440 [enabled_digests=""])
441 if test "x$enabled_digests" = "x" \
442 -o "$enabled_digests" = "yes" \
443 -o "$enabled_digests" = "no"; then
444 enabled_digests=$default_digests
446 AC_MSG_CHECKING([which message digests to include])
447 for digest in $enabled_digests; do
448 LIST_MEMBER($digest, $available_digests)
449 if test "$found" = "0"; then
450 AC_MSG_ERROR([unsupported message digest specified])
453 AC_MSG_RESULT([$enabled_digests])
455 # Implementation of the --enable-kdfs switch.
457 AC_HELP_STRING([--enable-kfds=kdfs],
458 [select the KDFs to include]),
459 [enabled_kdfs=`echo $enableval | tr ',:' ' ' | tr '[A-Z]' '[a-z]'`],
461 if test "x$enabled_kdfs" = "x" \
462 -o "$enabled_kdfs" = "yes" \
463 -o "$enabled_kdfs" = "no"; then
464 enabled_kdfs=$default_kdfs
466 AC_MSG_CHECKING([which key derivation functions to include])
467 for kdf in $enabled_kdfs; do
468 LIST_MEMBER($kdf, $available_kdfs)
469 if test "$found" = "0"; then
470 AC_MSG_ERROR([unsupported key derivation function specified])
473 AC_MSG_RESULT([$enabled_kdfs])
475 # Implementation of the --enable-random switch.
476 AC_ARG_ENABLE(random,
477 AC_HELP_STRING([--enable-random=name],
478 [select which random number generator to use]),
479 [random=`echo $enableval | tr '[A-Z]' '[a-z]'`],
481 if test "x$random" = "x" -o "$random" = "yes" -o "$random" = "no"; then
484 AC_MSG_CHECKING([which random module to use])
485 if test "$random" != "default" -a "$random" != "auto"; then
486 LIST_MEMBER($random, $available_random_modules)
487 if test "$found" = "0"; then
488 AC_MSG_ERROR([unsupported random module specified])
491 AC_MSG_RESULT($random)
493 # Implementation of the --disable-dev-random switch.
494 AC_MSG_CHECKING([whether use of /dev/random is requested])
495 AC_ARG_ENABLE(dev-random,
496 [ --disable-dev-random disable the use of dev random],
497 try_dev_random=$enableval, try_dev_random=yes)
498 AC_MSG_RESULT($try_dev_random)
500 # Implementation of the --with-egd-socket switch.
501 AC_ARG_WITH(egd-socket,
502 [ --with-egd-socket=NAME Use NAME for the EGD socket)],
503 egd_socket_name="$withval", egd_socket_name="" )
504 AC_DEFINE_UNQUOTED(EGD_SOCKET_NAME, "$egd_socket_name",
505 [Define if you don't want the default EGD socket name.
506 For details see cipher/rndegd.c])
508 # Implementation of the --enable-random-daemon
509 AC_MSG_CHECKING([whether the experimental random daemon is requested])
510 AC_ARG_ENABLE([random-daemon],
511 AC_HELP_STRING([--enable-random-daemon],
512 [Build and support the experimental gcryptrnd]),
513 [use_random_daemon=$enableval],
514 [use_random_daemon=no])
515 AC_MSG_RESULT($use_random_daemon)
516 if test x$use_random_daemon = xyes ; then
517 AC_DEFINE(USE_RANDOM_DAEMON,1,
518 [Define to support the experimental random daemon])
520 AM_CONDITIONAL(USE_RANDOM_DAEMON, test x$use_random_daemon = xyes)
523 # Implementation of --disable-asm.
524 AC_MSG_CHECKING([whether MPI assembler modules are requested])
526 AC_HELP_STRING([--disable-asm],
527 [Disable MPI assembler modules]),
528 [try_asm_modules=$enableval],
529 [try_asm_modules=yes])
530 AC_MSG_RESULT($try_asm_modules)
532 # Implementation of the --enable-m-guard switch.
533 AC_MSG_CHECKING([whether memory guard is requested])
534 AC_ARG_ENABLE(m-guard,
535 AC_HELP_STRING([--enable-m-guard],
536 [Enable memory guard facility]),
537 [use_m_guard=$enableval], [use_m_guard=no])
538 AC_MSG_RESULT($use_m_guard)
539 if test "$use_m_guard" = yes ; then
540 AC_DEFINE(M_GUARD,1,[Define to use the (obsolete) malloc guarding feature])
543 # Implementation of the --enable-large-data-tests switch.
544 AC_MSG_CHECKING([whether to run large data tests])
545 AC_ARG_ENABLE(large-data-tests,
546 AC_HELP_STRING([--enable-large-data-tests],
547 [Enable the real long ruinning large data tests]),
548 large_data_tests=$enableval,large_data_tests=no)
549 AC_MSG_RESULT($large_data_tests)
550 AC_SUBST(RUN_LARGE_DATA_TESTS, $large_data_tests)
553 # Implementation of the --with-capabilities switch.
554 # Check whether we want to use Linux capabilities
555 AC_MSG_CHECKING([whether use of capabilities is requested])
556 AC_ARG_WITH(capabilities,
557 AC_HELP_STRING([--with-capabilities],
558 [Use linux capabilities [default=no]]),
559 [use_capabilities="$withval"],[use_capabilities=no])
560 AC_MSG_RESULT($use_capabilities)
562 # Implementation of the --enable-hmac-binary-check.
563 AC_MSG_CHECKING([whether a HMAC binary check is requested])
564 AC_ARG_ENABLE(hmac-binary-check,
565 AC_HELP_STRING([--enable-hmac-binary-check],
566 [Enable library integrity check]),
567 [use_hmac_binary_check=$enableval],
568 [use_hmac_binary_check=no])
569 AC_MSG_RESULT($use_hmac_binary_check)
570 if test "$use_hmac_binary_check" = yes ; then
571 AC_DEFINE(ENABLE_HMAC_BINARY_CHECK,1,
572 [Define to support an HMAC based integrity check])
576 # Implementation of the --disable-padlock-support switch.
577 AC_MSG_CHECKING([whether padlock support is requested])
578 AC_ARG_ENABLE(padlock-support,
579 AC_HELP_STRING([--disable-padlock-support],
580 [Disable support for the PadLock Engine of VIA processors]),
581 padlocksupport=$enableval,padlocksupport=yes)
582 AC_MSG_RESULT($padlocksupport)
584 # Implementation of the --disable-aesni-support switch.
585 AC_MSG_CHECKING([whether AESNI support is requested])
586 AC_ARG_ENABLE(aesni-support,
587 AC_HELP_STRING([--disable-aesni-support],
588 [Disable support for the Intel AES-NI instructions]),
589 aesnisupport=$enableval,aesnisupport=yes)
590 AC_MSG_RESULT($aesnisupport)
592 # Implementation of the --disable-pclmul-support switch.
593 AC_MSG_CHECKING([whether PCLMUL support is requested])
594 AC_ARG_ENABLE(pclmul-support,
595 AC_HELP_STRING([--disable-pclmul-support],
596 [Disable support for the Intel PCLMUL instructions]),
597 pclmulsupport=$enableval,pclmulsupport=yes)
598 AC_MSG_RESULT($pclmulsupport)
600 # Implementation of the --disable-sse41-support switch.
601 AC_MSG_CHECKING([whether SSE4.1 support is requested])
602 AC_ARG_ENABLE(sse41-support,
603 AC_HELP_STRING([--disable-sse41-support],
604 [Disable support for the Intel SSE4.1 instructions]),
605 sse41support=$enableval,sse41support=yes)
606 AC_MSG_RESULT($sse41support)
608 # Implementation of the --disable-drng-support switch.
609 AC_MSG_CHECKING([whether DRNG support is requested])
610 AC_ARG_ENABLE(drng-support,
611 AC_HELP_STRING([--disable-drng-support],
612 [Disable support for the Intel DRNG (RDRAND instruction)]),
613 drngsupport=$enableval,drngsupport=yes)
614 AC_MSG_RESULT($drngsupport)
616 # Implementation of the --disable-avx-support switch.
617 AC_MSG_CHECKING([whether AVX support is requested])
618 AC_ARG_ENABLE(avx-support,
619 AC_HELP_STRING([--disable-avx-support],
620 [Disable support for the Intel AVX instructions]),
621 avxsupport=$enableval,avxsupport=yes)
622 AC_MSG_RESULT($avxsupport)
624 # Implementation of the --disable-avx2-support switch.
625 AC_MSG_CHECKING([whether AVX2 support is requested])
626 AC_ARG_ENABLE(avx2-support,
627 AC_HELP_STRING([--disable-avx2-support],
628 [Disable support for the Intel AVX2 instructions]),
629 avx2support=$enableval,avx2support=yes)
630 AC_MSG_RESULT($avx2support)
632 # Implementation of the --disable-neon-support switch.
633 AC_MSG_CHECKING([whether NEON support is requested])
634 AC_ARG_ENABLE(neon-support,
635 AC_HELP_STRING([--disable-neon-support],
636 [Disable support for the ARM NEON instructions]),
637 neonsupport=$enableval,neonsupport=yes)
638 AC_MSG_RESULT($neonsupport)
640 # Implementation of the --disable-arm-crypto-support switch.
641 AC_MSG_CHECKING([whether ARMv8 Crypto Extension support is requested])
642 AC_ARG_ENABLE(arm-crypto-support,
643 AC_HELP_STRING([--disable-arm-crypto-support],
644 [Disable support for the ARMv8 Crypto Extension instructions]),
645 armcryptosupport=$enableval,armcryptosupport=yes)
646 AC_MSG_RESULT($armcryptosupport)
648 # Implementation of the --disable-O-flag-munging switch.
649 AC_MSG_CHECKING([whether a -O flag munging is requested])
650 AC_ARG_ENABLE([O-flag-munging],
651 AC_HELP_STRING([--disable-O-flag-munging],
652 [Disable modification of the cc -O flag]),
653 [enable_o_flag_munging=$enableval],
654 [enable_o_flag_munging=yes])
655 AC_MSG_RESULT($enable_o_flag_munging)
656 AM_CONDITIONAL(ENABLE_O_FLAG_MUNGING, test "$enable_o_flag_munging" = "yes")
658 # Implementation of the --disable-amd64-as-feature-detection switch.
659 AC_MSG_CHECKING([whether to enable AMD64 as(1) feature detection])
660 AC_ARG_ENABLE(amd64-as-feature-detection,
661 AC_HELP_STRING([--disable-amd64-as-feature-detection],
662 [Disable the auto-detection of AMD64 as(1) features]),
663 amd64_as_feature_detection=$enableval,
664 amd64_as_feature_detection=yes)
665 AC_MSG_RESULT($amd64_as_feature_detection)
668 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
669 [A human readable text with the name of the OS])
671 # For some systems we know that we have ld_version scripts.
672 # Use it then as default.
673 have_ld_version_script=no
676 have_ld_version_script=yes
679 have_ld_version_script=yes
682 AC_ARG_ENABLE([ld-version-script],
683 AC_HELP_STRING([--enable-ld-version-script],
684 [enable/disable use of linker version script.
685 (default is system dependent)]),
686 [have_ld_version_script=$enableval],
688 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
690 AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, "$NAME_OF_DEV_RANDOM",
691 [defined to the name of the strong random device])
692 AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, "$NAME_OF_DEV_URANDOM",
693 [defined to the name of the weaker random device])
696 ###############################
697 #### Checks for libraries. ####
698 ###############################
701 # gpg-error is required.
703 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION")
704 if test "x$GPG_ERROR_LIBS" = "x"; then
705 AC_MSG_ERROR([libgpg-error is needed.
706 See ftp://ftp.gnupg.org/gcrypt/libgpg-error/ .])
709 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GCRYPT,
710 [The default error source for libgcrypt.])
713 # Check whether the GNU Pth library is available. We require this
714 # to build the optional gcryptrnd program.
716 AC_ARG_WITH(pth-prefix,
717 AC_HELP_STRING([--with-pth-prefix=PFX],
718 [prefix where GNU Pth is installed (optional)]),
719 pth_config_prefix="$withval", pth_config_prefix="")
720 if test x$pth_config_prefix != x ; then
721 PTH_CONFIG="$pth_config_prefix/bin/pth-config"
723 if test "$use_random_daemon" = "yes"; then
724 AC_PATH_PROG(PTH_CONFIG, pth-config, no)
725 if test "$PTH_CONFIG" = "no"; then
728 *** To build the Libgcrypt's random number daemon
729 *** we need the support of the GNU Portable Threads Library.
730 *** Download it from ftp://ftp.gnu.org/gnu/pth/
731 *** On a Debian GNU/Linux system you might want to try
732 *** apt-get install libpth-dev
735 GNUPG_PTH_VERSION_CHECK([1.3.7])
736 if test $have_pth = yes; then
737 PTH_CFLAGS=`$PTH_CONFIG --cflags`
738 PTH_LIBS=`$PTH_CONFIG --ldflags`
739 PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`"
740 AC_DEFINE(USE_GNU_PTH, 1,
741 [Defined if the GNU Portable Thread Library should be used])
742 AC_DEFINE(HAVE_PTH, 1,
743 [Defined if the GNU Pth is available])
751 # Check whether pthreads is available
753 if test "$have_w32_system" != yes; then
754 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
755 if test "$have_pthread" = yes; then
756 AC_DEFINE(HAVE_PTHREAD, 1 ,[Define if we have pthread.])
761 # Solaris needs -lsocket and -lnsl. Unisys system includes
762 # gethostbyname in libsocket but needs libnsl for socket.
763 AC_SEARCH_LIBS(setsockopt, [socket], ,
764 [AC_SEARCH_LIBS(setsockopt, [socket], , , [-lnsl])])
765 AC_SEARCH_LIBS(setsockopt, [nsl])
767 ##################################
768 #### Checks for header files. ####
769 ##################################
772 AC_CHECK_HEADERS(unistd.h sys/select.h sys/msg.h)
774 if test x"$ac_cv_header_sys_select_h" = xyes; then
775 INSERT_SYS_SELECT_H=" include <sys/select.h>"
777 AC_SUBST(INSERT_SYS_SELECT_H)
780 ##########################################
781 #### Checks for typedefs, structures, ####
782 #### and compiler characteristics. ####
783 ##########################################
792 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
793 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
794 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
795 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
796 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
801 # socklen_t may or may not be defined depending on what headers
802 # are included. To be safe we use int as this is the actual type.
803 FALLBACK_SOCKLEN_T="typedef int gcry_socklen_t;"
806 if test ".$gl_cv_socklen_t_equiv" = "."; then
807 FALLBACK_SOCKLEN_T="typedef socklen_t gcry_socklen_t;"
809 FALLBACK_SOCKLEN_T="typedef ${gl_cv_socklen_t_equiv} gcry_socklen_t;"
812 AC_SUBST(FALLBACK_SOCKLEN_T)
816 # Check for __builtin_bswap32 intrinsic.
818 AC_CACHE_CHECK(for __builtin_bswap32,
819 [gcry_cv_have_builtin_bswap32],
820 [gcry_cv_have_builtin_bswap32=no
821 AC_LINK_IFELSE([AC_LANG_PROGRAM([],
822 [int x = 0; int y = __builtin_bswap32(x); return y;])],
823 [gcry_cv_have_builtin_bswap32=yes])])
824 if test "$gcry_cv_have_builtin_bswap32" = "yes" ; then
825 AC_DEFINE(HAVE_BUILTIN_BSWAP32,1,
826 [Defined if compiler has '__builtin_bswap32' intrinsic])
831 # Check for __builtin_bswap64 intrinsic.
833 AC_CACHE_CHECK(for __builtin_bswap64,
834 [gcry_cv_have_builtin_bswap64],
835 [gcry_cv_have_builtin_bswap64=no
836 AC_LINK_IFELSE([AC_LANG_PROGRAM([],
837 [long long x = 0; long long y = __builtin_bswap64(x); return y;])],
838 [gcry_cv_have_builtin_bswap64=yes])])
839 if test "$gcry_cv_have_builtin_bswap64" = "yes" ; then
840 AC_DEFINE(HAVE_BUILTIN_BSWAP64,1,
841 [Defined if compiler has '__builtin_bswap64' intrinsic])
846 # Check for __builtin_ctz intrinsic.
848 AC_CACHE_CHECK(for __builtin_ctz,
849 [gcry_cv_have_builtin_ctz],
850 [gcry_cv_have_builtin_ctz=no
851 AC_LINK_IFELSE([AC_LANG_PROGRAM([],
852 [unsigned int x = 0; int y = __builtin_ctz(x); return y;])],
853 [gcry_cv_have_builtin_ctz=yes])])
854 if test "$gcry_cv_have_builtin_ctz" = "yes" ; then
855 AC_DEFINE(HAVE_BUILTIN_CTZ, 1,
856 [Defined if compiler has '__builtin_ctz' intrinsic])
861 # Check for VLA support (variable length arrays).
863 AC_CACHE_CHECK(whether the variable length arrays are supported,
866 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
867 [[void f1(char *, int);
869 char b[(i < 0 ? 0 : i) + 1];
870 f1(b, sizeof b); return b[0];}]])],
871 [gcry_cv_have_vla=yes])])
872 if test "$gcry_cv_have_vla" = "yes" ; then
873 AC_DEFINE(HAVE_VLA,1, [Defined if variable length arrays are supported])
878 # Check for ELF visibility support.
880 AC_CACHE_CHECK(whether the visibility attribute is supported,
881 gcry_cv_visibility_attribute,
882 [gcry_cv_visibility_attribute=no
883 AC_LANG_CONFTEST([AC_LANG_SOURCE(
884 [[int foo __attribute__ ((visibility ("hidden"))) = 1;
885 int bar __attribute__ ((visibility ("protected"))) = 1;
888 if ${CC-cc} -Werror -S conftest.c -o conftest.s \
889 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
890 if grep '\.hidden.*foo' conftest.s >/dev/null 2>&1 ; then
891 if grep '\.protected.*bar' conftest.s >/dev/null 2>&1; then
892 gcry_cv_visibility_attribute=yes
897 if test "$gcry_cv_visibility_attribute" = "yes"; then
898 AC_CACHE_CHECK(for broken visibility attribute,
899 gcry_cv_broken_visibility_attribute,
900 [gcry_cv_broken_visibility_attribute=yes
901 AC_LANG_CONFTEST([AC_LANG_SOURCE(
903 int bar (int x) __asm__ ("foo")
904 __attribute__ ((visibility ("hidden")));
905 int bar (int x) { return x; }
908 if ${CC-cc} -Werror -S conftest.c -o conftest.s \
909 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
910 if grep '\.hidden@<:@ _@:>@foo' conftest.s >/dev/null 2>&1;
912 gcry_cv_broken_visibility_attribute=no
917 if test "$gcry_cv_visibility_attribute" = "yes"; then
918 AC_CACHE_CHECK(for broken alias attribute,
919 gcry_cv_broken_alias_attribute,
920 [gcry_cv_broken_alias_attribute=yes
921 AC_LANG_CONFTEST([AC_LANG_SOURCE(
922 [[extern int foo (int x) __asm ("xyzzy");
923 int bar (int x) { return x; }
924 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
926 extern __typeof (dfoo) dfoo __asm ("abccb");
930 if ${CC-cc} -Werror -S conftest.c -o conftest.s \
931 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
932 if grep 'xyzzy' conftest.s >/dev/null 2>&1 && \
933 grep 'abccb' conftest.s >/dev/null 2>&1; then
934 gcry_cv_broken_alias_attribute=no
939 if test "$gcry_cv_visibility_attribute" = "yes"; then
940 AC_CACHE_CHECK(if gcc supports -fvisibility=hidden,
941 gcry_cv_gcc_has_f_visibility,
942 [gcry_cv_gcc_has_f_visibility=no
943 _gcc_cflags_save=$CFLAGS
944 CFLAGS="-fvisibility=hidden"
945 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
946 gcry_cv_gcc_has_f_visibility=yes)
947 CFLAGS=$_gcc_cflags_save;
950 if test "$gcry_cv_visibility_attribute" = "yes" \
951 && test "$gcry_cv_broken_visibility_attribute" != "yes" \
952 && test "$gcry_cv_broken_alias_attribute" != "yes" \
953 && test "$gcry_cv_gcc_has_f_visibility" = "yes"
955 AC_DEFINE(GCRY_USE_VISIBILITY, 1,
956 [Define to use the GNU C visibility attribute.])
957 CFLAGS="$CFLAGS -fvisibility=hidden"
962 # Check whether the compiler supports the GCC style aligned attribute
964 AC_CACHE_CHECK([whether the GCC style aligned attribute is supported],
965 [gcry_cv_gcc_attribute_aligned],
966 [gcry_cv_gcc_attribute_aligned=no
967 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
968 [[struct { int a; } foo __attribute__ ((aligned (16)));]])],
969 [gcry_cv_gcc_attribute_aligned=yes])])
970 if test "$gcry_cv_gcc_attribute_aligned" = "yes" ; then
971 AC_DEFINE(HAVE_GCC_ATTRIBUTE_ALIGNED,1,
972 [Defined if a GCC style "__attribute__ ((aligned (n))" is supported])
977 # Check whether the compiler supports the GCC style packed attribute
979 AC_CACHE_CHECK([whether the GCC style packed attribute is supported],
980 [gcry_cv_gcc_attribute_packed],
981 [gcry_cv_gcc_attribute_packed=no
982 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
983 [[struct foolong_s { long b; } __attribute__ ((packed));
984 struct foo_s { char a; struct foolong_s b; }
985 __attribute__ ((packed));
987 FOO = 1 / (sizeof(struct foo_s) == (sizeof(char) + sizeof(long))),
989 [gcry_cv_gcc_attribute_packed=yes])])
990 if test "$gcry_cv_gcc_attribute_packed" = "yes" ; then
991 AC_DEFINE(HAVE_GCC_ATTRIBUTE_PACKED,1,
992 [Defined if a GCC style "__attribute__ ((packed))" is supported])
997 # Check whether the compiler supports 'asm' or '__asm__' keyword for
1000 AC_CACHE_CHECK([whether 'asm' assembler keyword is supported],
1002 [gcry_cv_have_asm=no
1003 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1004 [[void a(void) { asm("":::"memory"); }]])],
1005 [gcry_cv_have_asm=yes])])
1006 AC_CACHE_CHECK([whether '__asm__' assembler keyword is supported],
1007 [gcry_cv_have___asm__],
1008 [gcry_cv_have___asm__=no
1009 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1010 [[void a(void) { __asm__("":::"memory"); }]])],
1011 [gcry_cv_have___asm__=yes])])
1012 if test "$gcry_cv_have_asm" = "no" ; then
1013 if test "$gcry_cv_have___asm__" = "yes" ; then
1014 AC_DEFINE(asm,__asm__,
1015 [Define to supported assembler block keyword, if plain 'asm' was not
1022 # Check whether the compiler supports inline assembly memory barrier.
1024 if test "$gcry_cv_have_asm" = "no" ; then
1025 if test "$gcry_cv_have___asm__" = "yes" ; then
1026 AC_CACHE_CHECK([whether inline assembly memory barrier is supported],
1027 [gcry_cv_have_asm_volatile_memory],
1028 [gcry_cv_have_asm_volatile_memory=no
1029 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1030 [[void a(void) { __asm__ volatile("":::"memory"); }]])],
1031 [gcry_cv_have_asm_volatile_memory=yes])])
1034 AC_CACHE_CHECK([whether inline assembly memory barrier is supported],
1035 [gcry_cv_have_asm_volatile_memory],
1036 [gcry_cv_have_asm_volatile_memory=no
1037 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1038 [[void a(void) { asm volatile("":::"memory"); }]])],
1039 [gcry_cv_have_asm_volatile_memory=yes])])
1041 if test "$gcry_cv_have_asm_volatile_memory" = "yes" ; then
1042 AC_DEFINE(HAVE_GCC_ASM_VOLATILE_MEMORY,1,
1043 [Define if inline asm memory barrier is supported])
1048 # Check whether GCC assembler supports features needed for our ARM
1049 # implementations. This needs to be done before setting up the
1052 AC_CACHE_CHECK([whether GCC assembler is compatible for ARM assembly implementations],
1053 [gcry_cv_gcc_arm_platform_as_ok],
1054 [gcry_cv_gcc_arm_platform_as_ok=no
1055 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1057 /* Test if assembler supports UAL syntax. */
1058 ".syntax unified\n\t"
1059 ".arm\n\t" /* our assembly code is in ARM mode */
1060 /* Following causes error if assembler ignored '.syntax unified'. */
1062 "add %r0, %r0, %r4, ror #12;\n\t"
1064 /* Test if '.type' and '.size' are supported. */
1065 ".size asmfunc,.-asmfunc;\n\t"
1066 ".type asmfunc,%function;\n\t"
1068 [gcry_cv_gcc_arm_platform_as_ok=yes])])
1069 if test "$gcry_cv_gcc_arm_platform_as_ok" = "yes" ; then
1070 AC_DEFINE(HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS,1,
1071 [Defined if underlying assembler is compatible with ARM assembly implementations])
1076 # Check whether GCC assembler supports features needed for our ARMv8/Aarch64
1077 # implementations. This needs to be done before setting up the
1080 AC_CACHE_CHECK([whether GCC assembler is compatible for ARMv8/Aarch64 assembly implementations],
1081 [gcry_cv_gcc_aarch64_platform_as_ok],
1082 [gcry_cv_gcc_aarch64_platform_as_ok=no
1083 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1086 "eor x0, x0, x30, ror #12;\n\t"
1087 "add x0, x0, x30, asr #12;\n\t"
1088 "eor v0.16b, v0.16b, v31.16b;\n\t"
1090 /* Test if '.type' and '.size' are supported. */
1091 ".size asmfunc,.-asmfunc;\n\t"
1092 ".type asmfunc,@function;\n\t"
1094 [gcry_cv_gcc_aarch64_platform_as_ok=yes])])
1095 if test "$gcry_cv_gcc_aarch64_platform_as_ok" = "yes" ; then
1096 AC_DEFINE(HAVE_COMPATIBLE_GCC_AARCH64_PLATFORM_AS,1,
1097 [Defined if underlying assembler is compatible with ARMv8/Aarch64 assembly implementations])
1102 # Check whether underscores in symbols are required. This needs to be
1103 # done before setting up the assembler stuff.
1105 GNUPG_SYS_SYMBOL_UNDERSCORE()
1108 #################################
1110 #### Setup assembler stuff. ####
1111 #### Define mpi_cpu_arch. ####
1113 #################################
1114 AC_ARG_ENABLE(mpi-path,
1115 AC_HELP_STRING([--enable-mpi-path=EXTRA_PATH],
1116 [prepend EXTRA_PATH to list of CPU specific optimizations]),
1117 mpi_extra_path="$enableval",mpi_extra_path="")
1118 AC_MSG_CHECKING(architecture and mpi assembler functions)
1119 if test -f $srcdir/mpi/config.links ; then
1120 . $srcdir/mpi/config.links
1121 AC_CONFIG_LINKS("$mpi_ln_list")
1122 ac_cv_mpi_sflags="$mpi_sflags"
1123 AC_MSG_RESULT($mpi_cpu_arch)
1125 AC_MSG_RESULT(failed)
1126 AC_MSG_ERROR([mpi/config.links missing!])
1128 MPI_SFLAGS="$ac_cv_mpi_sflags"
1129 AC_SUBST(MPI_SFLAGS)
1131 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_ADD1, test "$mpi_mod_asm_mpih_add1" = yes)
1132 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_SUB1, test "$mpi_mod_asm_mpih_sub1" = yes)
1133 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL1, test "$mpi_mod_asm_mpih_mul1" = yes)
1134 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL2, test "$mpi_mod_asm_mpih_mul2" = yes)
1135 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL3, test "$mpi_mod_asm_mpih_mul3" = yes)
1136 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_LSHIFT, test "$mpi_mod_asm_mpih_lshift" = yes)
1137 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_RSHIFT, test "$mpi_mod_asm_mpih_rshift" = yes)
1138 AM_CONDITIONAL(MPI_MOD_ASM_UDIV, test "$mpi_mod_asm_udiv" = yes)
1139 AM_CONDITIONAL(MPI_MOD_ASM_UDIV_QRNND, test "$mpi_mod_asm_udiv_qrnnd" = yes)
1140 AM_CONDITIONAL(MPI_MOD_C_MPIH_ADD1, test "$mpi_mod_c_mpih_add1" = yes)
1141 AM_CONDITIONAL(MPI_MOD_C_MPIH_SUB1, test "$mpi_mod_c_mpih_sub1" = yes)
1142 AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL1, test "$mpi_mod_c_mpih_mul1" = yes)
1143 AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL2, test "$mpi_mod_c_mpih_mul2" = yes)
1144 AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL3, test "$mpi_mod_c_mpih_mul3" = yes)
1145 AM_CONDITIONAL(MPI_MOD_C_MPIH_LSHIFT, test "$mpi_mod_c_mpih_lshift" = yes)
1146 AM_CONDITIONAL(MPI_MOD_C_MPIH_RSHIFT, test "$mpi_mod_c_mpih_rshift" = yes)
1147 AM_CONDITIONAL(MPI_MOD_C_UDIV, test "$mpi_mod_c_udiv" = yes)
1148 AM_CONDITIONAL(MPI_MOD_C_UDIV_QRNND, test "$mpi_mod_c_udiv_qrnnd" = yes)
1150 # Reset non applicable feature flags.
1151 if test "$mpi_cpu_arch" != "x86" ; then
1157 padlocksupport="n/a"
1161 if test "$mpi_cpu_arch" != "arm" ; then
1162 if test "$mpi_cpu_arch" != "aarch64" ; then
1164 armcryptosupport="n/a"
1169 #############################################
1171 #### Platform specific compiler checks. ####
1173 #############################################
1176 # Following tests depend on warnings to cause compile to fail, so set -Werror
1178 _gcc_cflags_save=$CFLAGS
1179 CFLAGS="$CFLAGS -Werror"
1183 # Check whether compiler supports 'ms_abi' function attribute.
1185 AC_CACHE_CHECK([whether compiler supports 'ms_abi' function attribute],
1186 [gcry_cv_gcc_attribute_ms_abi],
1187 [gcry_cv_gcc_attribute_ms_abi=no
1188 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1189 [[int __attribute__ ((ms_abi)) proto(int);]])],
1190 [gcry_cv_gcc_attribute_ms_abi=yes])])
1191 if test "$gcry_cv_gcc_attribute_ms_abi" = "yes" ; then
1192 AC_DEFINE(HAVE_GCC_ATTRIBUTE_MS_ABI,1,
1193 [Defined if compiler supports "__attribute__ ((ms_abi))" function attribute])
1198 # Check whether compiler supports 'sysv_abi' function attribute.
1200 AC_CACHE_CHECK([whether compiler supports 'sysv_abi' function attribute],
1201 [gcry_cv_gcc_attribute_sysv_abi],
1202 [gcry_cv_gcc_attribute_sysv_abi=no
1203 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1204 [[int __attribute__ ((sysv_abi)) proto(int);]])],
1205 [gcry_cv_gcc_attribute_sysv_abi=yes])])
1206 if test "$gcry_cv_gcc_attribute_sysv_abi" = "yes" ; then
1207 AC_DEFINE(HAVE_GCC_ATTRIBUTE_SYSV_ABI,1,
1208 [Defined if compiler supports "__attribute__ ((sysv_abi))" function attribute])
1213 # Check whether default calling convention is 'ms_abi'.
1215 if test "$gcry_cv_gcc_attribute_ms_abi" = "yes" ; then
1216 AC_CACHE_CHECK([whether default calling convention is 'ms_abi'],
1217 [gcry_cv_gcc_default_abi_is_ms_abi],
1218 [gcry_cv_gcc_default_abi_is_ms_abi=no
1219 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1220 [[void *test(void) {
1221 void *(*def_func)(void) = test;
1222 void *__attribute__((ms_abi))(*msabi_func)(void);
1223 /* warning on SysV abi targets, passes on Windows based targets */
1224 msabi_func = def_func;
1227 [gcry_cv_gcc_default_abi_is_ms_abi=yes])])
1228 if test "$gcry_cv_gcc_default_abi_is_ms_abi" = "yes" ; then
1229 AC_DEFINE(HAVE_GCC_DEFAULT_ABI_IS_MS_ABI,1,
1230 [Defined if default calling convention is 'ms_abi'])
1236 # Check whether default calling convention is 'sysv_abi'.
1238 if test "$gcry_cv_gcc_attribute_sysv_abi" = "yes" ; then
1239 AC_CACHE_CHECK([whether default calling convention is 'sysv_abi'],
1240 [gcry_cv_gcc_default_abi_is_sysv_abi],
1241 [gcry_cv_gcc_default_abi_is_sysv_abi=no
1242 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1243 [[void *test(void) {
1244 void *(*def_func)(void) = test;
1245 void *__attribute__((sysv_abi))(*sysvabi_func)(void);
1246 /* warning on MS ABI targets, passes on SysV ABI targets */
1247 sysvabi_func = def_func;
1248 return sysvabi_func;
1250 [gcry_cv_gcc_default_abi_is_sysv_abi=yes])])
1251 if test "$gcry_cv_gcc_default_abi_is_sysv_abi" = "yes" ; then
1252 AC_DEFINE(HAVE_GCC_DEFAULT_ABI_IS_SYSV_ABI,1,
1253 [Defined if default calling convention is 'sysv_abi'])
1259 CFLAGS=$_gcc_cflags_save;
1263 # Check whether GCC inline assembler supports SSSE3 instructions
1264 # This is required for the AES-NI instructions.
1266 AC_CACHE_CHECK([whether GCC inline assembler supports SSSE3 instructions],
1267 [gcry_cv_gcc_inline_asm_ssse3],
1268 [if test "$mpi_cpu_arch" != "x86" ; then
1269 gcry_cv_gcc_inline_asm_ssse3="n/a"
1271 gcry_cv_gcc_inline_asm_ssse3=no
1272 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1273 [[static unsigned char be_mask[16] __attribute__ ((aligned (16))) =
1274 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
1276 __asm__("pshufb %[mask], %%xmm2\n\t"::[mask]"m"(*be_mask):);
1278 [gcry_cv_gcc_inline_asm_ssse3=yes])
1280 if test "$gcry_cv_gcc_inline_asm_ssse3" = "yes" ; then
1281 AC_DEFINE(HAVE_GCC_INLINE_ASM_SSSE3,1,
1282 [Defined if inline assembler supports SSSE3 instructions])
1287 # Check whether GCC inline assembler supports PCLMUL instructions.
1289 AC_CACHE_CHECK([whether GCC inline assembler supports PCLMUL instructions],
1290 [gcry_cv_gcc_inline_asm_pclmul],
1291 [if test "$mpi_cpu_arch" != "x86" ; then
1292 gcry_cv_gcc_inline_asm_pclmul="n/a"
1294 gcry_cv_gcc_inline_asm_pclmul=no
1295 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1297 __asm__("pclmulqdq \$0, %%xmm1, %%xmm3\n\t":::"cc");
1299 [gcry_cv_gcc_inline_asm_pclmul=yes])
1301 if test "$gcry_cv_gcc_inline_asm_pclmul" = "yes" ; then
1302 AC_DEFINE(HAVE_GCC_INLINE_ASM_PCLMUL,1,
1303 [Defined if inline assembler supports PCLMUL instructions])
1307 # Check whether GCC inline assembler supports SSE4.1 instructions.
1309 AC_CACHE_CHECK([whether GCC inline assembler supports SSE4.1 instructions],
1310 [gcry_cv_gcc_inline_asm_sse41],
1311 [if test "$mpi_cpu_arch" != "x86" ; then
1312 gcry_cv_gcc_inline_asm_sse41="n/a"
1314 gcry_cv_gcc_inline_asm_sse41=no
1315 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1318 __asm__("pextrd \$2, %%xmm0, %[out]\n\t" : [out] "=m" (i));
1320 [gcry_cv_gcc_inline_asm_sse41=yes])
1322 if test "$gcry_cv_gcc_inline_asm_sse41" = "yes" ; then
1323 AC_DEFINE(HAVE_GCC_INLINE_ASM_SSE41,1,
1324 [Defined if inline assembler supports SSE4.1 instructions])
1329 # Check whether GCC inline assembler supports AVX instructions
1331 AC_CACHE_CHECK([whether GCC inline assembler supports AVX instructions],
1332 [gcry_cv_gcc_inline_asm_avx],
1333 [if test "$mpi_cpu_arch" != "x86" ; then
1334 gcry_cv_gcc_inline_asm_avx="n/a"
1336 gcry_cv_gcc_inline_asm_avx=no
1337 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1339 __asm__("xgetbv; vaesdeclast (%[mem]),%%xmm0,%%xmm7\n\t"::[mem]"r"(0):);
1341 [gcry_cv_gcc_inline_asm_avx=yes])
1343 if test "$gcry_cv_gcc_inline_asm_avx" = "yes" ; then
1344 AC_DEFINE(HAVE_GCC_INLINE_ASM_AVX,1,
1345 [Defined if inline assembler supports AVX instructions])
1350 # Check whether GCC inline assembler supports AVX2 instructions
1352 AC_CACHE_CHECK([whether GCC inline assembler supports AVX2 instructions],
1353 [gcry_cv_gcc_inline_asm_avx2],
1354 [if test "$mpi_cpu_arch" != "x86" ; then
1355 gcry_cv_gcc_inline_asm_avx2="n/a"
1357 gcry_cv_gcc_inline_asm_avx2=no
1358 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1360 __asm__("xgetbv; vpbroadcastb %%xmm7,%%ymm1\n\t":::"cc");
1362 [gcry_cv_gcc_inline_asm_avx2=yes])
1364 if test "$gcry_cv_gcc_inline_asm_avx2" = "yes" ; then
1365 AC_DEFINE(HAVE_GCC_INLINE_ASM_AVX2,1,
1366 [Defined if inline assembler supports AVX2 instructions])
1371 # Check whether GCC inline assembler supports BMI2 instructions
1373 AC_CACHE_CHECK([whether GCC inline assembler supports BMI2 instructions],
1374 [gcry_cv_gcc_inline_asm_bmi2],
1375 [if test "$mpi_cpu_arch" != "x86" ; then
1376 gcry_cv_gcc_inline_asm_bmi2="n/a"
1378 gcry_cv_gcc_inline_asm_bmi2=no
1379 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1381 __asm__("rorxl \$23, %%eax, %%edx\\n\\t":::"memory");
1383 [gcry_cv_gcc_inline_asm_bmi2=yes])
1385 if test "$gcry_cv_gcc_inline_asm_bmi2" = "yes" ; then
1386 AC_DEFINE(HAVE_GCC_INLINE_ASM_BMI2,1,
1387 [Defined if inline assembler supports BMI2 instructions])
1392 # Check whether GCC assembler needs "-Wa,--divide" to correctly handle
1395 if test $amd64_as_feature_detection = yes; then
1396 AC_CACHE_CHECK([whether GCC assembler handles division correctly],
1397 [gcry_cv_gcc_as_const_division_ok],
1398 [gcry_cv_gcc_as_const_division_ok=no
1399 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1400 [[__asm__("xorl \$(123456789/12345678), %ebp;\n\t");]])],
1401 [gcry_cv_gcc_as_const_division_ok=yes])])
1402 if test "$gcry_cv_gcc_as_const_division_ok" = "no" ; then
1404 # Add '-Wa,--divide' to CPPFLAGS and try check again.
1406 _gcc_cppflags_save="$CPPFLAGS"
1407 CPPFLAGS="$CPPFLAGS -Wa,--divide"
1408 AC_CACHE_CHECK([whether GCC assembler handles division correctly with "-Wa,--divide"],
1409 [gcry_cv_gcc_as_const_division_with_wadivide_ok],
1410 [gcry_cv_gcc_as_const_division_with_wadivide_ok=no
1411 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1412 [[__asm__("xorl \$(123456789/12345678), %ebp;\n\t");]])],
1413 [gcry_cv_gcc_as_const_division_with_wadivide_ok=yes])])
1414 if test "$gcry_cv_gcc_as_const_division_with_wadivide_ok" = "no" ; then
1415 # '-Wa,--divide' did not work, restore old flags.
1416 CPPFLAGS="$_gcc_cppflags_save"
1423 # Check whether GCC assembler supports features needed for our amd64
1426 if test $amd64_as_feature_detection = yes; then
1427 AC_CACHE_CHECK([whether GCC assembler is compatible for amd64 assembly implementations],
1428 [gcry_cv_gcc_amd64_platform_as_ok],
1429 [if test "$mpi_cpu_arch" != "x86" ; then
1430 gcry_cv_gcc_amd64_platform_as_ok="n/a"
1432 gcry_cv_gcc_amd64_platform_as_ok=no
1433 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1435 /* Test if '.type' and '.size' are supported. */
1436 /* These work only on ELF targets. */
1438 ".size asmfunc,.-asmfunc;\n\t"
1439 ".type asmfunc,@function;\n\t"
1440 /* Test if assembler allows use of '/' for constant division
1441 * (Solaris/x86 issue). If previous constant division check
1442 * and "-Wa,--divide" workaround failed, this causes assembly
1443 * to be disable on this machine. */
1444 "xorl \$(123456789/12345678), %ebp;\n\t"
1446 [gcry_cv_gcc_amd64_platform_as_ok=yes])
1448 if test "$gcry_cv_gcc_amd64_platform_as_ok" = "yes" ; then
1449 AC_DEFINE(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS,1,
1450 [Defined if underlying assembler is compatible with amd64 assembly implementations])
1452 if test "$gcry_cv_gcc_amd64_platform_as_ok" = "no" &&
1453 test "$gcry_cv_gcc_attribute_sysv_abi" = "yes" &&
1454 test "$gcry_cv_gcc_default_abi_is_ms_abi" = "yes"; then
1455 AC_CACHE_CHECK([whether GCC assembler is compatible for WIN64 assembly implementations],
1456 [gcry_cv_gcc_win64_platform_as_ok],
1457 [gcry_cv_gcc_win64_platform_as_ok=no
1458 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1460 ".globl asmfunc\n\t"
1462 "xorq \$(1234), %rbp;\n\t"
1464 [gcry_cv_gcc_win64_platform_as_ok=yes])])
1465 if test "$gcry_cv_gcc_win64_platform_as_ok" = "yes" ; then
1466 AC_DEFINE(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS,1,
1467 [Defined if underlying assembler is compatible with WIN64 assembly implementations])
1474 # Check whether GCC assembler supports features needed for assembly
1475 # implementations that use Intel syntax
1477 AC_CACHE_CHECK([whether GCC assembler is compatible for Intel syntax assembly implementations],
1478 [gcry_cv_gcc_platform_as_ok_for_intel_syntax],
1479 [if test "$mpi_cpu_arch" != "x86" ; then
1480 gcry_cv_gcc_platform_as_ok_for_intel_syntax="n/a"
1482 gcry_cv_gcc_platform_as_ok_for_intel_syntax=no
1483 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1485 ".intel_syntax noprefix\n\t"
1486 "pxor xmm1, xmm7;\n\t"
1487 /* Intel syntax implementation also use GAS macros, so check
1491 ".macro SET_VAL_A p1\n\t"
1492 " VAL_A = \\\\p1 \n\t"
1494 ".macro SET_VAL_B p1\n\t"
1495 " VAL_B = \\\\p1 \n\t"
1497 "vmovdqa VAL_A, VAL_B;\n\t"
1500 "add VAL_A, VAL_B;\n\t"
1501 "add VAL_B, 0b10101;\n\t"
1503 [gcry_cv_gcc_platform_as_ok_for_intel_syntax=yes])
1505 if test "$gcry_cv_gcc_platform_as_ok_for_intel_syntax" = "yes" ; then
1506 AC_DEFINE(HAVE_INTEL_SYNTAX_PLATFORM_AS,1,
1507 [Defined if underlying assembler is compatible with Intel syntax assembly implementations])
1512 # Check whether compiler is configured for ARMv6 or newer architecture
1514 AC_CACHE_CHECK([whether compiler is configured for ARMv6 or newer architecture],
1515 [gcry_cv_cc_arm_arch_is_v6],
1516 [if test "$mpi_cpu_arch" != "arm" ; then
1517 gcry_cv_cc_arm_arch_is_v6="n/a"
1519 gcry_cv_cc_arm_arch_is_v6=no
1520 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1522 #if defined(__arm__) && \
1523 ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
1524 || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
1525 || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
1526 || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
1527 || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
1528 || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
1529 || defined(__ARM_ARCH_7EM__))
1532 /* fail compile if not ARMv6. */
1533 not_armv6 not_armv6 = (not_armv6)not_armv6;
1536 [gcry_cv_cc_arm_arch_is_v6=yes])
1538 if test "$gcry_cv_cc_arm_arch_is_v6" = "yes" ; then
1539 AC_DEFINE(HAVE_ARM_ARCH_V6,1,
1540 [Defined if ARM architecture is v6 or newer])
1545 # Check whether GCC inline assembler supports NEON instructions
1547 AC_CACHE_CHECK([whether GCC inline assembler supports NEON instructions],
1548 [gcry_cv_gcc_inline_asm_neon],
1549 [if test "$mpi_cpu_arch" != "arm" ; then
1550 gcry_cv_gcc_inline_asm_neon="n/a"
1552 gcry_cv_gcc_inline_asm_neon=no
1553 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1555 ".syntax unified\n\t"
1558 "vld1.64 {%q0-%q1}, [%r0]!;\n\t"
1559 "vrev64.8 %q0, %q3;\n\t"
1560 "vadd.u64 %q0, %q1;\n\t"
1561 "vadd.s64 %d3, %d2, %d3;\n\t"
1564 [gcry_cv_gcc_inline_asm_neon=yes])
1566 if test "$gcry_cv_gcc_inline_asm_neon" = "yes" ; then
1567 AC_DEFINE(HAVE_GCC_INLINE_ASM_NEON,1,
1568 [Defined if inline assembler supports NEON instructions])
1573 # Check whether GCC inline assembler supports AArch32 Crypto Extension instructions
1575 AC_CACHE_CHECK([whether GCC inline assembler supports AArch32 Crypto Extension instructions],
1576 [gcry_cv_gcc_inline_asm_aarch32_crypto],
1577 [if test "$mpi_cpu_arch" != "arm" ; then
1578 gcry_cv_gcc_inline_asm_aarch32_crypto="n/a"
1580 gcry_cv_gcc_inline_asm_aarch32_crypto=no
1581 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1583 ".syntax unified\n\t"
1585 ".fpu crypto-neon-fp-armv8\n\t"
1587 "sha1h.32 q0, q0;\n\t"
1588 "sha1c.32 q0, q0, q0;\n\t"
1589 "sha1p.32 q0, q0, q0;\n\t"
1590 "sha1su0.32 q0, q0, q0;\n\t"
1591 "sha1su1.32 q0, q0;\n\t"
1593 "sha256h.32 q0, q0, q0;\n\t"
1594 "sha256h2.32 q0, q0, q0;\n\t"
1595 "sha1p.32 q0, q0, q0;\n\t"
1596 "sha256su0.32 q0, q0;\n\t"
1597 "sha256su1.32 q0, q0, q15;\n\t"
1599 "aese.8 q0, q0;\n\t"
1600 "aesd.8 q0, q0;\n\t"
1601 "aesmc.8 q0, q0;\n\t"
1602 "aesimc.8 q0, q0;\n\t"
1604 "vmull.p64 q0, d0, d0;\n\t"
1607 [gcry_cv_gcc_inline_asm_aarch32_crypto=yes])
1609 if test "$gcry_cv_gcc_inline_asm_aarch32_crypto" = "yes" ; then
1610 AC_DEFINE(HAVE_GCC_INLINE_ASM_AARCH32_CRYPTO,1,
1611 [Defined if inline assembler supports AArch32 Crypto Extension instructions])
1616 # Check whether GCC inline assembler supports AArch64 NEON instructions
1618 AC_CACHE_CHECK([whether GCC inline assembler supports AArch64 NEON instructions],
1619 [gcry_cv_gcc_inline_asm_aarch64_neon],
1620 [if test "$mpi_cpu_arch" != "aarch64" ; then
1621 gcry_cv_gcc_inline_asm_aarch64_neon="n/a"
1623 gcry_cv_gcc_inline_asm_aarch64_neon=no
1624 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1628 "dup v0.8b, w0;\n\t"
1629 "ld4 {v0.8b,v1.8b,v2.8b,v3.8b},[x0],\#32;\n\t"
1632 [gcry_cv_gcc_inline_asm_aarch64_neon=yes])
1634 if test "$gcry_cv_gcc_inline_asm_aarch64_neon" = "yes" ; then
1635 AC_DEFINE(HAVE_GCC_INLINE_ASM_AARCH64_NEON,1,
1636 [Defined if inline assembler supports AArch64 NEON instructions])
1641 # Check whether GCC inline assembler supports AArch64 Crypto Extension instructions
1643 AC_CACHE_CHECK([whether GCC inline assembler supports AArch64 Crypto Extension instructions],
1644 [gcry_cv_gcc_inline_asm_aarch64_crypto],
1645 [if test "$mpi_cpu_arch" != "aarch64" ; then
1646 gcry_cv_gcc_inline_asm_aarch64_crypto="n/a"
1648 gcry_cv_gcc_inline_asm_aarch64_crypto=no
1649 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1651 ".arch armv8-a+crypto\n\t"
1654 "sha1c q0, s0, v0.4s;\n\t"
1655 "sha1p q0, s0, v0.4s;\n\t"
1656 "sha1su0 v0.4s, v0.4s, v0.4s;\n\t"
1657 "sha1su1 v0.4s, v0.4s;\n\t"
1659 "sha256h q0, q0, v0.4s;\n\t"
1660 "sha256h2 q0, q0, v0.4s;\n\t"
1661 "sha1p q0, s0, v0.4s;\n\t"
1662 "sha256su0 v0.4s, v0.4s;\n\t"
1663 "sha256su1 v0.4s, v0.4s, v31.4s;\n\t"
1665 "aese v0.16b, v0.16b;\n\t"
1666 "aesd v0.16b, v0.16b;\n\t"
1667 "aesmc v0.16b, v0.16b;\n\t"
1668 "aesimc v0.16b, v0.16b;\n\t"
1670 "pmull v0.1q, v0.1d, v31.1d;\n\t"
1671 "pmull2 v0.1q, v0.2d, v31.2d;\n\t"
1674 [gcry_cv_gcc_inline_asm_aarch64_crypto=yes])
1676 if test "$gcry_cv_gcc_inline_asm_aarch64_crypto" = "yes" ; then
1677 AC_DEFINE(HAVE_GCC_INLINE_ASM_AARCH64_CRYPTO,1,
1678 [Defined if inline assembler supports AArch64 Crypto Extension instructions])
1682 #######################################
1683 #### Checks for library functions. ####
1684 #######################################
1687 # We have replacements for these in src/missing-string.c
1688 AC_CHECK_FUNCS(stpcpy strcasecmp)
1689 # We have replacements for these in src/g10lib.h
1690 AC_CHECK_FUNCS(strtoul memmove stricmp atexit raise)
1692 AC_CHECK_FUNCS(strerror rand mmap getpagesize sysconf waitpid wait4)
1693 AC_CHECK_FUNCS(gettimeofday getrusage gethrtime clock_gettime syslog)
1694 AC_CHECK_FUNCS(syscall fcntl ftruncate flockfile)
1699 # Replacement functions.
1701 AC_REPLACE_FUNCS([getpid clock])
1705 # Check wether it is necessary to link against libdl.
1708 if test "$use_hmac_binary_check" = yes ; then
1709 _gcry_save_libs="$LIBS"
1711 AC_SEARCH_LIBS(dlopen, c dl,,,)
1713 LIBS="$_gcry_save_libs"
1714 LIBGCRYPT_CONFIG_LIBS="${LIBGCRYPT_CONFIG_LIBS} ${DL_LIBS}"
1720 # Check whether we can use Linux capabilities as requested.
1722 if test "$use_capabilities" = "yes" ; then
1724 AC_CHECK_HEADERS(sys/capability.h)
1725 if test "$ac_cv_header_sys_capability_h" = "yes" ; then
1726 AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1)
1727 if test "$ac_cv_lib_cap_cap_init" = "yes"; then
1728 AC_DEFINE(USE_CAPABILITIES,1,
1729 [define if capabilities should be used])
1731 use_capabilities=yes
1734 if test "$use_capabilities" = "no" ; then
1737 *** The use of capabilities on this system is not possible.
1738 *** You need a recent Linux kernel and some patches:
1739 *** fcaps-2.2.9-990610.patch (kernel patch for 2.2.9)
1740 *** fcap-module-990613.tar.gz (kernel module)
1741 *** libcap-1.92.tar.gz (user mode library and utilities)
1742 *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN
1743 *** set (filesystems menu). Be warned: This code is *really* ALPHA.
1748 # Check whether a random device is available.
1749 if test "$try_dev_random" = yes ; then
1750 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1751 [if test -r "$NAME_OF_DEV_RANDOM" && test -r "$NAME_OF_DEV_URANDOM" ; then
1752 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
1753 if test "$ac_cv_have_dev_random" = yes; then
1754 AC_DEFINE(HAVE_DEV_RANDOM,1,
1755 [defined if the system supports a random device] )
1758 AC_MSG_CHECKING(for random device)
1759 ac_cv_have_dev_random=no
1760 AC_MSG_RESULT(has been disabled)
1763 # Figure out the random modules for this configuration.
1764 if test "$random" = "default"; then
1766 # Select default value.
1767 if test "$ac_cv_have_dev_random" = yes; then
1768 # Try Linuxish random device.
1769 random_modules="linux"
1773 # WindowsCE random device.
1774 random_modules="w32ce"
1776 *-*-mingw32*|*-*-cygwin*)
1777 # Windows random device.
1778 random_modules="w32"
1781 # Build everything, allow to select at runtime.
1782 random_modules="$auto_random_modules"
1787 if test "$random" = "auto"; then
1788 # Build everything, allow to select at runtime.
1789 random_modules="$auto_random_modules"
1791 random_modules="$random"
1799 if test mym4_isgit = "yes"; then
1800 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1801 [Defined if this is not a regular release])
1805 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1808 # This is handy for debugging so the compiler doesn't rearrange
1809 # things and eliminate variables.
1810 AC_ARG_ENABLE(optimization,
1811 AC_HELP_STRING([--disable-optimization],
1812 [disable compiler optimization]),
1813 [if test $enableval = no ; then
1814 CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
1817 # CFLAGS mangling when using gcc.
1818 if test "$GCC" = yes; then
1819 CFLAGS="$CFLAGS -Wall"
1820 if test "$USE_MAINTAINER_MODE" = "yes"; then
1821 CFLAGS="$CFLAGS -Wcast-align -Wshadow -Wstrict-prototypes"
1822 CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1824 # If -Wno-missing-field-initializers is supported we can enable a
1825 # a bunch of really useful warnings.
1826 AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1827 _gcc_cflags_save=$CFLAGS
1828 CFLAGS="-Wno-missing-field-initializers"
1829 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1830 AC_MSG_RESULT($_gcc_wopt)
1831 CFLAGS=$_gcc_cflags_save;
1832 if test x"$_gcc_wopt" = xyes ; then
1833 CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast"
1834 CFLAGS="$CFLAGS -Wwrite-strings"
1835 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1836 CFLAGS="$CFLAGS -Wno-missing-field-initializers"
1837 CFLAGS="$CFLAGS -Wno-sign-compare"
1840 AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1841 _gcc_cflags_save=$CFLAGS
1842 CFLAGS="-Wpointer-arith"
1843 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1844 AC_MSG_RESULT($_gcc_wopt)
1845 CFLAGS=$_gcc_cflags_save;
1846 if test x"$_gcc_wopt" = xyes ; then
1847 CFLAGS="$CFLAGS -Wpointer-arith"
1853 # Check whether as(1) supports a noeexecstack feature. This test
1854 # includes an override option.
1858 AC_SUBST(LIBGCRYPT_CONFIG_API_VERSION)
1859 AC_SUBST(LIBGCRYPT_CONFIG_LIBS)
1860 AC_SUBST(LIBGCRYPT_CONFIG_CFLAGS)
1861 AC_SUBST(LIBGCRYPT_CONFIG_HOST)
1862 AC_SUBST(LIBGCRYPT_THREAD_MODULES)
1864 AC_CONFIG_COMMANDS([gcrypt-conf],[[
1865 chmod +x src/libgcrypt-config
1868 exec_prefix=$exec_prefix
1871 DATADIRNAME=$DATADIRNAME
1874 #####################
1875 #### Conclusion. ####
1876 #####################
1878 # Check that requested feature can actually be used and define
1879 # ENABLE_foo_SUPPORT macros.
1881 if test x"$aesnisupport" = xyes ; then
1882 if test "$gcry_cv_gcc_inline_asm_ssse3" != "yes" ; then
1883 aesnisupport="no (unsupported by compiler)"
1886 if test x"$pclmulsupport" = xyes ; then
1887 if test "$gcry_cv_gcc_inline_asm_pclmul" != "yes" ; then
1888 pclmulsupport="no (unsupported by compiler)"
1891 if test x"$sse41support" = xyes ; then
1892 if test "$gcry_cv_gcc_inline_asm_sse41" != "yes" ; then
1893 sse41support="no (unsupported by compiler)"
1896 if test x"$avxsupport" = xyes ; then
1897 if test "$gcry_cv_gcc_inline_asm_avx" != "yes" ; then
1898 avxsupport="no (unsupported by compiler)"
1901 if test x"$avx2support" = xyes ; then
1902 if test "$gcry_cv_gcc_inline_asm_avx2" != "yes" ; then
1903 avx2support="no (unsupported by compiler)"
1906 if test x"$neonsupport" = xyes ; then
1907 if test "$gcry_cv_gcc_inline_asm_neon" != "yes" ; then
1908 if test "$gcry_cv_gcc_inline_asm_aarch64_neon" != "yes" ; then
1909 neonsupport="no (unsupported by compiler)"
1913 if test x"$armcryptosupport" = xyes ; then
1914 if test "$gcry_cv_gcc_inline_asm_aarch32_crypto" != "yes" ; then
1915 if test "$gcry_cv_gcc_inline_asm_aarch64_crypto" != "yes" ; then
1916 neonsupport="no (unsupported by compiler)"
1921 if test x"$aesnisupport" = xyes ; then
1922 AC_DEFINE(ENABLE_AESNI_SUPPORT, 1,
1923 [Enable support for Intel AES-NI instructions.])
1925 if test x"$pclmulsupport" = xyes ; then
1926 AC_DEFINE(ENABLE_PCLMUL_SUPPORT, 1,
1927 [Enable support for Intel PCLMUL instructions.])
1929 if test x"$sse41support" = xyes ; then
1930 AC_DEFINE(ENABLE_SSE41_SUPPORT, 1,
1931 [Enable support for Intel SSE4.1 instructions.])
1933 if test x"$avxsupport" = xyes ; then
1934 AC_DEFINE(ENABLE_AVX_SUPPORT,1,
1935 [Enable support for Intel AVX instructions.])
1937 if test x"$avx2support" = xyes ; then
1938 AC_DEFINE(ENABLE_AVX2_SUPPORT,1,
1939 [Enable support for Intel AVX2 instructions.])
1941 if test x"$neonsupport" = xyes ; then
1942 AC_DEFINE(ENABLE_NEON_SUPPORT,1,
1943 [Enable support for ARM NEON instructions.])
1945 if test x"$armcryptosupport" = xyes ; then
1946 AC_DEFINE(ENABLE_ARM_CRYPTO_SUPPORT,1,
1947 [Enable support for ARMv8 Crypto Extension instructions.])
1949 if test x"$padlocksupport" = xyes ; then
1950 AC_DEFINE(ENABLE_PADLOCK_SUPPORT, 1,
1951 [Enable support for the PadLock engine.])
1953 if test x"$drngsupport" = xyes ; then
1954 AC_DEFINE(ENABLE_DRNG_SUPPORT, 1,
1955 [Enable support for Intel DRNG (RDRAND instruction).])
1959 # Define conditional sources and config.h symbols depending on the
1960 # selected ciphers, pubkey-ciphers, digests, kdfs, and random modules.
1962 LIST_MEMBER(arcfour, $enabled_ciphers)
1963 if test "$found" = "1"; then
1964 GCRYPT_CIPHERS="$GCRYPT_CIPHERS arcfour.lo"
1965 AC_DEFINE(USE_ARCFOUR, 1, [Defined if this module should be included])
1969 # Build with the assembly implementation
1970 GCRYPT_CIPHERS="$GCRYPT_CIPHERS arcfour-amd64.lo"
1975 LIST_MEMBER(blowfish, $enabled_ciphers)
1976 if test "$found" = "1" ; then
1977 GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish.lo"
1978 AC_DEFINE(USE_BLOWFISH, 1, [Defined if this module should be included])
1982 # Build with the assembly implementation
1983 GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish-amd64.lo"
1986 # Build with the assembly implementation
1987 GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish-arm.lo"
1992 LIST_MEMBER(cast5, $enabled_ciphers)
1993 if test "$found" = "1" ; then
1994 GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5.lo"
1995 AC_DEFINE(USE_CAST5, 1, [Defined if this module should be included])
1999 # Build with the assembly implementation
2000 GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5-amd64.lo"
2003 # Build with the assembly implementation
2004 GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5-arm.lo"
2009 LIST_MEMBER(des, $enabled_ciphers)
2010 if test "$found" = "1" ; then
2011 GCRYPT_CIPHERS="$GCRYPT_CIPHERS des.lo"
2012 AC_DEFINE(USE_DES, 1, [Defined if this module should be included])
2016 # Build with the assembly implementation
2017 GCRYPT_CIPHERS="$GCRYPT_CIPHERS des-amd64.lo"
2022 LIST_MEMBER(aes, $enabled_ciphers)
2023 if test "$found" = "1" ; then
2024 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael.lo"
2025 AC_DEFINE(USE_AES, 1, [Defined if this module should be included])
2029 # Build with the assembly implementation
2030 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-amd64.lo"
2032 # Build with the SSSE3 implementation
2033 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-ssse3-amd64.lo"
2036 # Build with the assembly implementation
2037 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-arm.lo"
2039 # Build with the ARMv8/AArch32 CE implementation
2040 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-armv8-ce.lo"
2041 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-armv8-aarch32-ce.lo"
2044 # Build with the assembly implementation
2045 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-aarch64.lo"
2047 # Build with the ARMv8/AArch64 CE implementation
2048 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-armv8-ce.lo"
2049 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-armv8-aarch64-ce.lo"
2053 case "$mpi_cpu_arch" in
2055 # Build with the AES-NI implementation
2056 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-aesni.lo"
2058 # Build with the Padlock implementation
2059 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-padlock.lo"
2064 LIST_MEMBER(twofish, $enabled_ciphers)
2065 if test "$found" = "1" ; then
2066 GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish.lo"
2067 AC_DEFINE(USE_TWOFISH, 1, [Defined if this module should be included])
2071 # Build with the assembly implementation
2072 GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish-amd64.lo"
2075 # Build with the assembly implementation
2076 GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish-arm.lo"
2079 # Build with the assembly implementation
2080 GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish-aarch64.lo"
2085 LIST_MEMBER(serpent, $enabled_ciphers)
2086 if test "$found" = "1" ; then
2087 GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent.lo"
2088 AC_DEFINE(USE_SERPENT, 1, [Defined if this module should be included])
2092 # Build with the SSE2 implementation
2093 GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent-sse2-amd64.lo"
2097 if test x"$avx2support" = xyes ; then
2098 # Build with the AVX2 implementation
2099 GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent-avx2-amd64.lo"
2102 if test x"$neonsupport" = xyes ; then
2103 # Build with the NEON implementation
2104 GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent-armv7-neon.lo"
2108 LIST_MEMBER(rfc2268, $enabled_ciphers)
2109 if test "$found" = "1" ; then
2110 GCRYPT_CIPHERS="$GCRYPT_CIPHERS rfc2268.lo"
2111 AC_DEFINE(USE_RFC2268, 1, [Defined if this module should be included])
2114 LIST_MEMBER(seed, $enabled_ciphers)
2115 if test "$found" = "1" ; then
2116 GCRYPT_CIPHERS="$GCRYPT_CIPHERS seed.lo"
2117 AC_DEFINE(USE_SEED, 1, [Defined if this module should be included])
2120 LIST_MEMBER(camellia, $enabled_ciphers)
2121 if test "$found" = "1" ; then
2122 GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia.lo camellia-glue.lo"
2123 AC_DEFINE(USE_CAMELLIA, 1, [Defined if this module should be included])
2127 # Build with the assembly implementation
2128 GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-arm.lo"
2131 # Build with the assembly implementation
2132 GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-aarch64.lo"
2136 if test x"$avxsupport" = xyes ; then
2137 if test x"$aesnisupport" = xyes ; then
2138 # Build with the AES-NI/AVX implementation
2139 GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-aesni-avx-amd64.lo"
2143 if test x"$avx2support" = xyes ; then
2144 if test x"$aesnisupport" = xyes ; then
2145 # Build with the AES-NI/AVX2 implementation
2146 GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-aesni-avx2-amd64.lo"
2151 LIST_MEMBER(idea, $enabled_ciphers)
2152 if test "$found" = "1" ; then
2153 GCRYPT_CIPHERS="$GCRYPT_CIPHERS idea.lo"
2154 AC_DEFINE(USE_IDEA, 1, [Defined if this module should be included])
2157 LIST_MEMBER(salsa20, $enabled_ciphers)
2158 if test "$found" = "1" ; then
2159 GCRYPT_CIPHERS="$GCRYPT_CIPHERS salsa20.lo"
2160 AC_DEFINE(USE_SALSA20, 1, [Defined if this module should be included])
2164 # Build with the assembly implementation
2165 GCRYPT_CIPHERS="$GCRYPT_CIPHERS salsa20-amd64.lo"
2169 if test x"$neonsupport" = xyes ; then
2170 # Build with the NEON implementation
2171 GCRYPT_CIPHERS="$GCRYPT_CIPHERS salsa20-armv7-neon.lo"
2175 LIST_MEMBER(gost28147, $enabled_ciphers)
2176 if test "$found" = "1" ; then
2177 GCRYPT_CIPHERS="$GCRYPT_CIPHERS gost28147.lo"
2178 AC_DEFINE(USE_GOST28147, 1, [Defined if this module should be included])
2181 LIST_MEMBER(chacha20, $enabled_ciphers)
2182 if test "$found" = "1" ; then
2183 GCRYPT_CIPHERS="$GCRYPT_CIPHERS chacha20.lo"
2184 AC_DEFINE(USE_CHACHA20, 1, [Defined if this module should be included])
2188 # Build with the assembly implementation
2189 GCRYPT_CIPHERS="$GCRYPT_CIPHERS chacha20-sse2-amd64.lo"
2190 GCRYPT_CIPHERS="$GCRYPT_CIPHERS chacha20-ssse3-amd64.lo"
2191 GCRYPT_CIPHERS="$GCRYPT_CIPHERS chacha20-avx2-amd64.lo"
2195 if test x"$neonsupport" = xyes ; then
2196 # Build with the NEON implementation
2197 GCRYPT_CIPHERS="$GCRYPT_CIPHERS chacha20-armv7-neon.lo"
2203 # Build with the assembly implementation
2204 GCRYPT_CIPHERS="$GCRYPT_CIPHERS poly1305-sse2-amd64.lo"
2205 GCRYPT_CIPHERS="$GCRYPT_CIPHERS poly1305-avx2-amd64.lo"
2209 if test x"$neonsupport" = xyes ; then
2210 # Build with the NEON implementation
2211 GCRYPT_CIPHERS="$GCRYPT_CIPHERS poly1305-armv7-neon.lo"
2214 LIST_MEMBER(dsa, $enabled_pubkey_ciphers)
2215 if test "$found" = "1" ; then
2216 GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS dsa.lo"
2217 AC_DEFINE(USE_DSA, 1, [Defined if this module should be included])
2220 LIST_MEMBER(rsa, $enabled_pubkey_ciphers)
2221 if test "$found" = "1" ; then
2222 GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS rsa.lo"
2223 AC_DEFINE(USE_RSA, 1, [Defined if this module should be included])
2226 LIST_MEMBER(elgamal, $enabled_pubkey_ciphers)
2227 if test "$found" = "1" ; then
2228 GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS elgamal.lo"
2229 AC_DEFINE(USE_ELGAMAL, 1, [Defined if this module should be included])
2232 LIST_MEMBER(ecc, $enabled_pubkey_ciphers)
2233 if test "$found" = "1" ; then
2234 GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS \
2235 ecc.lo ecc-curves.lo ecc-misc.lo \
2236 ecc-ecdsa.lo ecc-eddsa.lo ecc-gost.lo"
2237 AC_DEFINE(USE_ECC, 1, [Defined if this module should be included])
2240 LIST_MEMBER(crc, $enabled_digests)
2241 if test "$found" = "1" ; then
2242 GCRYPT_DIGESTS="$GCRYPT_DIGESTS crc.lo"
2243 AC_DEFINE(USE_CRC, 1, [Defined if this module should be included])
2246 i?86-*-* | x86_64-*-*)
2247 # Build with the assembly implementation
2248 GCRYPT_DIGESTS="$GCRYPT_DIGESTS crc-intel-pclmul.lo"
2253 LIST_MEMBER(gostr3411-94, $enabled_digests)
2254 if test "$found" = "1" ; then
2255 # GOST R 34.11-94 internally uses GOST 28147-89
2256 LIST_MEMBER(gost28147, $enabled_ciphers)
2257 if test "$found" = "1" ; then
2258 GCRYPT_DIGESTS="$GCRYPT_DIGESTS gostr3411-94.lo"
2259 AC_DEFINE(USE_GOST_R_3411_94, 1, [Defined if this module should be included])
2263 LIST_MEMBER(stribog, $enabled_digests)
2264 if test "$found" = "1" ; then
2265 GCRYPT_DIGESTS="$GCRYPT_DIGESTS stribog.lo"
2266 AC_DEFINE(USE_GOST_R_3411_12, 1, [Defined if this module should be included])
2269 LIST_MEMBER(md2, $enabled_digests)
2270 if test "$found" = "1" ; then
2271 GCRYPT_DIGESTS="$GCRYPT_DIGESTS md2.lo"
2272 AC_DEFINE(USE_MD2, 1, [Defined if this module should be included])
2275 LIST_MEMBER(md4, $enabled_digests)
2276 if test "$found" = "1" ; then
2277 GCRYPT_DIGESTS="$GCRYPT_DIGESTS md4.lo"
2278 AC_DEFINE(USE_MD4, 1, [Defined if this module should be included])
2281 LIST_MEMBER(md5, $enabled_digests)
2282 if test "$found" = "1" ; then
2283 GCRYPT_DIGESTS="$GCRYPT_DIGESTS md5.lo"
2284 AC_DEFINE(USE_MD5, 1, [Defined if this module should be included])
2287 LIST_MEMBER(rmd160, $enabled_digests)
2288 if test "$found" = "1" ; then
2289 GCRYPT_DIGESTS="$GCRYPT_DIGESTS rmd160.lo"
2290 AC_DEFINE(USE_RMD160, 1, [Defined if this module should be included])
2293 LIST_MEMBER(sha256, $enabled_digests)
2294 if test "$found" = "1" ; then
2295 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256.lo"
2296 AC_DEFINE(USE_SHA256, 1, [Defined if this module should be included])
2300 # Build with the assembly implementation
2301 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-ssse3-amd64.lo"
2302 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-avx-amd64.lo"
2303 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-avx2-bmi2-amd64.lo"
2306 # Build with the assembly implementation
2307 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-armv8-aarch32-ce.lo"
2310 # Build with the assembly implementation
2311 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-armv8-aarch64-ce.lo"
2316 LIST_MEMBER(sha512, $enabled_digests)
2317 if test "$found" = "1" ; then
2318 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512.lo"
2319 AC_DEFINE(USE_SHA512, 1, [Defined if this module should be included])
2323 # Build with the assembly implementation
2324 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-ssse3-amd64.lo"
2325 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-avx-amd64.lo"
2326 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-avx2-bmi2-amd64.lo"
2329 # Build with the assembly implementation
2330 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-arm.lo"
2334 if test x"$neonsupport" = xyes ; then
2335 # Build with the NEON implementation
2336 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-armv7-neon.lo"
2340 LIST_MEMBER(sha3, $enabled_digests)
2341 if test "$found" = "1" ; then
2342 GCRYPT_DIGESTS="$GCRYPT_DIGESTS keccak.lo"
2343 AC_DEFINE(USE_SHA3, 1, [Defined if this module should be included])
2347 # Build with the assembly implementation
2352 if test x"$neonsupport" = xyes ; then
2353 # Build with the NEON implementation
2354 GCRYPT_DIGESTS="$GCRYPT_DIGESTS keccak-armv7-neon.lo"
2358 LIST_MEMBER(tiger, $enabled_digests)
2359 if test "$found" = "1" ; then
2360 GCRYPT_DIGESTS="$GCRYPT_DIGESTS tiger.lo"
2361 AC_DEFINE(USE_TIGER, 1, [Defined if this module should be included])
2364 LIST_MEMBER(whirlpool, $enabled_digests)
2365 if test "$found" = "1" ; then
2366 GCRYPT_DIGESTS="$GCRYPT_DIGESTS whirlpool.lo"
2367 AC_DEFINE(USE_WHIRLPOOL, 1, [Defined if this module should be included])
2371 # Build with the assembly implementation
2372 GCRYPT_DIGESTS="$GCRYPT_DIGESTS whirlpool-sse2-amd64.lo"
2377 # SHA-1 needs to be included always for example because it is used by
2379 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1.lo"
2380 AC_DEFINE(USE_SHA1, 1, [Defined if this module should be included])
2384 # Build with the assembly implementation
2385 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-ssse3-amd64.lo"
2386 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-avx-amd64.lo"
2387 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-avx-bmi2-amd64.lo"
2390 # Build with the assembly implementation
2391 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-armv7-neon.lo"
2392 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-armv8-aarch32-ce.lo"
2395 # Build with the assembly implementation
2396 GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-armv8-aarch64-ce.lo"
2400 LIST_MEMBER(scrypt, $enabled_kdfs)
2401 if test "$found" = "1" ; then
2402 GCRYPT_KDFS="$GCRYPT_KDFS scrypt.lo"
2403 AC_DEFINE(USE_SCRYPT, 1, [Defined if this module should be included])
2406 LIST_MEMBER(linux, $random_modules)
2407 if test "$found" = "1" ; then
2408 GCRYPT_RANDOM="$GCRYPT_RANDOM rndlinux.lo"
2409 AC_DEFINE(USE_RNDLINUX, 1, [Defined if the /dev/random RNG should be used.])
2412 LIST_MEMBER(unix, $random_modules)
2413 if test "$found" = "1" ; then
2414 GCRYPT_RANDOM="$GCRYPT_RANDOM rndunix.lo"
2415 AC_DEFINE(USE_RNDUNIX, 1, [Defined if the default Unix RNG should be used.])
2416 print_egd_notice=yes
2419 LIST_MEMBER(egd, $random_modules)
2420 if test "$found" = "1" ; then
2421 GCRYPT_RANDOM="$GCRYPT_RANDOM rndegd.lo"
2422 AC_DEFINE(USE_RNDEGD, 1, [Defined if the EGD based RNG should be used.])
2425 LIST_MEMBER(w32, $random_modules)
2426 if test "$found" = "1" ; then
2427 GCRYPT_RANDOM="$GCRYPT_RANDOM rndw32.lo"
2428 AC_DEFINE(USE_RNDW32, 1,
2429 [Defined if the Windows specific RNG should be used.])
2432 LIST_MEMBER(w32ce, $random_modules)
2433 if test "$found" = "1" ; then
2434 GCRYPT_RANDOM="$GCRYPT_RANDOM rndw32ce.lo"
2435 AC_DEFINE(USE_RNDW32CE, 1,
2436 [Defined if the WindowsCE specific RNG should be used.])
2439 AC_SUBST([GCRYPT_CIPHERS])
2440 AC_SUBST([GCRYPT_PUBKEY_CIPHERS])
2441 AC_SUBST([GCRYPT_DIGESTS])
2442 AC_SUBST([GCRYPT_KDFS])
2443 AC_SUBST([GCRYPT_RANDOM])
2445 AC_SUBST(LIBGCRYPT_CIPHERS, $enabled_ciphers)
2446 AC_SUBST(LIBGCRYPT_PUBKEY_CIPHERS, $enabled_pubkey_ciphers)
2447 AC_SUBST(LIBGCRYPT_DIGESTS, $enabled_digests)
2449 # For printing the configuration we need a colon separated list of
2451 tmp=`echo "$enabled_ciphers" | tr ' ' : `
2452 AC_DEFINE_UNQUOTED(LIBGCRYPT_CIPHERS, "$tmp",
2453 [List of available cipher algorithms])
2454 tmp=`echo "$enabled_pubkey_ciphers" | tr ' ' : `
2455 AC_DEFINE_UNQUOTED(LIBGCRYPT_PUBKEY_CIPHERS, "$tmp",
2456 [List of available public key cipher algorithms])
2457 tmp=`echo "$enabled_digests" | tr ' ' : `
2458 AC_DEFINE_UNQUOTED(LIBGCRYPT_DIGESTS, "$tmp",
2459 [List of available digest algorithms])
2460 tmp=`echo "$enabled_kdfs" | tr ' ' : `
2461 AC_DEFINE_UNQUOTED(LIBGCRYPT_KDFS, "$tmp",
2462 [List of available KDF algorithms])
2466 # Define conditional sources depending on the used hardware platform.
2467 # Note that all possible modules must also be listed in
2468 # src/Makefile.am (EXTRA_libgcrypt_la_SOURCES).
2471 case "$mpi_cpu_arch" in
2473 AC_DEFINE(HAVE_CPU_ARCH_X86, 1, [Defined for the x86 platforms])
2474 GCRYPT_HWF_MODULES="hwf-x86.lo"
2477 AC_DEFINE(HAVE_CPU_ARCH_ALPHA, 1, [Defined for Alpha platforms])
2480 AC_DEFINE(HAVE_CPU_ARCH_SPARC, 1, [Defined for SPARC platforms])
2483 AC_DEFINE(HAVE_CPU_ARCH_MIPS, 1, [Defined for MIPS platforms])
2486 AC_DEFINE(HAVE_CPU_ARCH_M68K, 1, [Defined for M68k platforms])
2489 AC_DEFINE(HAVE_CPU_ARCH_PPC, 1, [Defined for PPC platforms])
2492 AC_DEFINE(HAVE_CPU_ARCH_ARM, 1, [Defined for ARM platforms])
2493 GCRYPT_HWF_MODULES="hwf-arm.lo"
2496 AC_DEFINE(HAVE_CPU_ARCH_ARM, 1, [Defined for ARM AArch64 platforms])
2497 GCRYPT_HWF_MODULES="hwf-arm.lo"
2500 AC_SUBST([GCRYPT_HWF_MODULES])
2504 # Option to disable building of doc file
2507 AC_ARG_ENABLE([doc], AC_HELP_STRING([--disable-doc],
2508 [do not build the documentation]),
2509 build_doc=$enableval, build_doc=yes)
2510 AM_CONDITIONAL([BUILD_DOC], [test "x$build_doc" != xno])
2514 # Provide information about the build.
2516 BUILD_REVISION="mym4_revision"
2517 AC_SUBST(BUILD_REVISION)
2518 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
2519 [GIT commit id revision used to build this package])
2522 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
2524 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
2525 AC_SUBST(BUILD_FILEVERSION)
2527 AC_ARG_ENABLE([build-timestamp],
2528 AC_HELP_STRING([--enable-build-timestamp],
2529 [set an explicit build timestamp for reproducibility.
2530 (default is the current time in ISO-8601 format)]),
2531 [if test "$enableval" = "yes"; then
2532 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
2534 BUILD_TIMESTAMP="$enableval"
2536 [BUILD_TIMESTAMP="<none>"])
2537 AC_SUBST(BUILD_TIMESTAMP)
2538 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
2539 [The time this package was configured for a build])
2542 # And create the files.
2553 src/libgcrypt-config
2557 AC_CONFIG_FILES([tests/hashtest-256g], [chmod +x tests/hashtest-256g])
2561 detection_module="${GCRYPT_HWF_MODULES%.lo}"
2562 test -n "$detection_module" || detection_module="none"
2564 # Give some feedback
2565 GCRY_MSG_SHOW([],[])
2566 GCRY_MSG_SHOW([Libgcrypt],[v${VERSION} has been configured as follows:])
2567 GCRY_MSG_SHOW([],[])
2568 GCRY_MSG_SHOW([Platform: ],[$PRINTABLE_OS_NAME ($host)])
2569 GCRY_MSG_SHOW([Hardware detection module:],[$detection_module])
2570 GCRY_MSG_WRAP([Enabled cipher algorithms:],[$enabled_ciphers])
2571 GCRY_MSG_WRAP([Enabled digest algorithms:],[$enabled_digests])
2572 GCRY_MSG_WRAP([Enabled kdf algorithms: ],[$enabled_kdfs])
2573 GCRY_MSG_WRAP([Enabled pubkey algorithms:],[$enabled_pubkey_ciphers])
2574 GCRY_MSG_SHOW([Random number generator: ],[$random])
2575 GCRY_MSG_SHOW([Using linux capabilities: ],[$use_capabilities])
2576 GCRY_MSG_SHOW([Try using Padlock crypto: ],[$padlocksupport])
2577 GCRY_MSG_SHOW([Try using AES-NI crypto: ],[$aesnisupport])
2578 GCRY_MSG_SHOW([Try using Intel PCLMUL: ],[$pclmulsupport])
2579 GCRY_MSG_SHOW([Try using Intel SSE4.1: ],[$sse41support])
2580 GCRY_MSG_SHOW([Try using DRNG (RDRAND): ],[$drngsupport])
2581 GCRY_MSG_SHOW([Try using Intel AVX: ],[$avxsupport])
2582 GCRY_MSG_SHOW([Try using Intel AVX2: ],[$avx2support])
2583 GCRY_MSG_SHOW([Try using ARM NEON: ],[$neonsupport])
2584 GCRY_MSG_SHOW([Try using ARMv8 crypto: ],[$armcryptosupport])
2585 GCRY_MSG_SHOW([],[])
2587 if test "x${gpg_config_script_warn}" != x; then
2589 Mismatches between the target platform and the to
2590 be used libraries have been been detected for:
2591 ${gpg_config_script_warn}
2592 Please check above for warning messages.
2596 if test "$print_egd_notice" = "yes"; then
2598 The performance of the Unix random gatherer module (rndunix) is not
2599 very good and it does not keep the entropy pool over multiple
2600 invocations of Libgcrypt base applications. The suggested way to
2601 overcome this problem is to use the
2603 Entropy Gathering Daemon (EGD)
2605 which provides a entropy source for the whole system. It is written
2606 in Perl and available at the GnuPG FTP servers. For more information
2607 consult the GnuPG site:
2609 https://gnupg.org/related_software/swlist.html#egd
2614 if test "$gcry_cv_gcc_attribute_aligned" != "yes" ; then
2616 Please not that your compiler does not support the GCC style
2617 aligned attribute. Using this software may evoke bus errors.
2622 if test -n "$gpl"; then
2623 echo "Please note that you are building a version of Libgcrypt with"
2625 echo "included. These parts are licensed under the GPL and thus the"
2626 echo "use of this library has to comply with the conditions of the GPL."