Add MD2 message digest implementation
[libgcrypt.git] / configure.ac
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  g10 Code GmbH
5 #
6 # This file is part of Libgcrypt.
7 #
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.
12 #
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.
17 #
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/>.
20
21 # (Process this file with autoconf to produce a configure script.)
22 AC_REVISION($Revision$)
23 AC_PREREQ(2.60)
24 min_automake_version="1.10"
25
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, [7])
33 m4_define(mym4_version_micro, [0])
34
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])
50
51 AC_INIT([libgcrypt],[mym4_full_version],[http://bugs.gnupg.org])
52
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=20
58 LIBGCRYPT_LT_AGE=0
59 LIBGCRYPT_LT_REVISION=0
60
61
62 # If the API is changed in an incompatible way: increment the next counter.
63 #
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
67
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.13
71
72 PACKAGE=$PACKAGE_NAME
73 VERSION=$PACKAGE_VERSION
74
75 AC_CONFIG_AUX_DIR([build-aux])
76 AC_CONFIG_SRCDIR([src/libgcrypt.vers])
77 AM_INIT_AUTOMAKE
78 AC_CONFIG_HEADER(config.h)
79 AC_CONFIG_MACRO_DIR([m4])
80 AC_CONFIG_LIBOBJ_DIR([compat])
81 AC_CANONICAL_HOST
82 AM_MAINTAINER_MODE
83 AM_SILENT_RULES
84
85 AH_TOP([
86 #ifndef _GCRYPT_CONFIG_H_INCLUDED
87 #define _GCRYPT_CONFIG_H_INCLUDED
88
89 /* Enable gpg-error's strerror macro for W32CE.  */
90 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
91 ])
92
93 AH_BOTTOM([
94 #define _GCRYPT_IN_LIBGCRYPT 1
95
96 /* If the configure check for endianness has been disabled, get it from
97    OS macros.  This is intended for making fat binary builds on OS X.  */
98 #ifdef DISABLED_ENDIAN_CHECK
99 # if defined(__BIG_ENDIAN__)
100 #  define WORDS_BIGENDIAN 1
101 # elif defined(__LITTLE_ENDIAN__)
102 #  undef WORDS_BIGENDIAN
103 # else
104 #  error "No endianness found"
105 # endif
106 #endif /*DISABLED_ENDIAN_CHECK*/
107
108 /* We basically use the original Camellia source.  Make sure the symbols
109    properly prefixed.  */
110 #define CAMELLIA_EXT_SYM_PREFIX _gcry_
111
112 #endif /*_GCRYPT_CONFIG_H_INCLUDED*/
113 ])
114
115 AH_VERBATIM([_REENTRANT],
116 [/* To allow the use of Libgcrypt in multithreaded programs we have to use
117     special features from the library. */
118 #ifndef _REENTRANT
119 # define _REENTRANT 1
120 #endif
121 ])
122
123
124 AC_SUBST(LIBGCRYPT_LT_CURRENT)
125 AC_SUBST(LIBGCRYPT_LT_AGE)
126 AC_SUBST(LIBGCRYPT_LT_REVISION)
127 AC_SUBST(PACKAGE)
128 AC_SUBST(VERSION)
129 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
130 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
131 VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \
132                           mym4_version_minor mym4_version_micro)
133 AC_SUBST(VERSION_NUMBER)
134
135
136 ######################
137 ##  Basic checks.  ### (we need some results later on (e.g. $GCC)
138 ######################
139
140 AC_PROG_MAKE_SET
141 missing_dir=`cd $ac_aux_dir && pwd`
142 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
143 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
144 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
145 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
146 # AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
147 AC_PROG_CC
148 AC_PROG_CPP
149 AM_PROG_CC_C_O
150 AM_PROG_AS
151 AC_ISC_POSIX
152 AC_PROG_INSTALL
153 AC_PROG_AWK
154
155 AC_GNU_SOURCE
156
157 # We need to compile and run a program on the build machine.  A
158 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
159 # the AC archive is broken for autoconf 2.57.  Given that there is no
160 # newer version of that macro, we assume that it is also broken for
161 # autoconf 2.61 and thus we use a simple but usually sufficient
162 # approach.
163 AC_MSG_CHECKING(for cc for build)
164 if test "$cross_compiling" = "yes"; then
165   CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
166 else
167   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
168 fi
169 AC_MSG_RESULT($CC_FOR_BUILD)
170 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
171
172
173 LT_PREREQ([2.2.6])
174 LT_INIT([win32-dll disable-static])
175 LT_LANG([Windows Resource])
176
177
178 ##########################
179 ## General definitions. ##
180 ##########################
181
182 # Used by libgcrypt-config
183 LIBGCRYPT_CONFIG_LIBS="-lgcrypt"
184 LIBGCRYPT_CONFIG_CFLAGS=""
185 LIBGCRYPT_CONFIG_HOST="$host"
186
187 # Definitions for symmetric ciphers.
188 available_ciphers="arcfour blowfish cast5 des aes twofish serpent rfc2268 seed"
189 available_ciphers="$available_ciphers camellia idea salsa20 gost28147"
190 enabled_ciphers=""
191
192 # Definitions for public-key ciphers.
193 available_pubkey_ciphers="dsa elgamal rsa ecc"
194 enabled_pubkey_ciphers=""
195
196 # Definitions for message digests.
197 available_digests="crc gostr3411-94 md2 md4 md5 rmd160 sha1 sha256"
198 available_digests_64="sha512 tiger whirlpool stribog"
199 enabled_digests=""
200
201 # Definitions for kdfs (optional ones)
202 available_kdfs="s2k pkdf2"
203 available_kdfs_64="scrypt"
204 enabled_kdfs=""
205
206 # Definitions for random modules.
207 available_random_modules="linux egd unix"
208 auto_random_modules="$available_random_modules"
209
210 # Supported thread backends.
211 LIBGCRYPT_THREAD_MODULES=""
212
213 # Other definitions.
214 print_egd_notice=no
215 have_w32_system=no
216 have_w32ce_system=no
217 have_pthread=no
218
219
220 # Setup some stuff depending on host.
221 case "${host}" in
222     *-*-mingw32*)
223       ac_cv_have_dev_random=no
224       have_w32_system=yes
225       case "${host}" in
226         *-mingw32ce*)
227             have_w32ce_system=yes
228             available_random_modules="w32ce"
229             ;;
230         *)
231             available_random_modules="w32"
232             ;;
233       esac
234       AC_DEFINE(USE_ONLY_8DOT3,1,
235                 [set this to limit filenames to the 8.3 format])
236       AC_DEFINE(HAVE_DRIVE_LETTERS,1,
237                 [defined if we must run on a stupid file system])
238       AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
239                 [defined if we run on some of the PCDOS like systems
240                  (DOS, Windoze. OS/2) with special properties like
241                   no file modes])
242       ;;
243
244     i?86-emx-os2 | i?86-*-os2*emx)
245         # OS/2 with the EMX environment
246         ac_cv_have_dev_random=no
247         AC_DEFINE(HAVE_DRIVE_LETTERS)
248         AC_DEFINE(HAVE_DOSISH_SYSTEM)
249         ;;
250
251     i?86-*-msdosdjgpp*)
252         # DOS with the DJGPP environment
253         ac_cv_have_dev_random=no
254         AC_DEFINE(HAVE_DRIVE_LETTERS)
255         AC_DEFINE(HAVE_DOSISH_SYSTEM)
256         ;;
257
258     *-*-hpux*)
259         if test -z "$GCC" ; then
260             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
261         fi
262         ;;
263     *-dec-osf4*)
264         if test -z "$GCC" ; then
265             # Suppress all warnings
266             # to get rid of the unsigned/signed char mismatch warnings.
267             CFLAGS="$CFLAGS -w"
268         fi
269         ;;
270     m68k-atari-mint)
271         ;;
272     *)
273       ;;
274 esac
275
276 if test "$have_w32_system" = yes; then
277    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
278    if test "$have_w32ce_system" = yes; then
279      AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
280    fi
281 fi
282 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
283 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
284
285
286
287 # A printable OS Name is sometimes useful.
288 case "${host}" in
289     *-*-mingw32ce*)
290         PRINTABLE_OS_NAME="W32CE"
291         ;;
292
293     *-*-mingw32*)
294         PRINTABLE_OS_NAME="W32"
295         ;;
296
297     i?86-emx-os2 | i?86-*-os2*emx )
298         PRINTABLE_OS_NAME="OS/2"
299         ;;
300
301     i?86-*-msdosdjgpp*)
302         PRINTABLE_OS_NAME="MSDOS/DJGPP"
303         ;;
304
305     *-linux*)
306         PRINTABLE_OS_NAME="GNU/Linux"
307         ;;
308
309     *)
310         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
311         ;;
312 esac
313
314 #
315 # Figure out the name of the random device
316 #
317 case "${host}" in
318     *-openbsd*)
319         NAME_OF_DEV_RANDOM="/dev/srandom"
320         NAME_OF_DEV_URANDOM="/dev/urandom"
321         ;;
322
323     *)
324         NAME_OF_DEV_RANDOM="/dev/random"
325         NAME_OF_DEV_URANDOM="/dev/urandom"
326         ;;
327 esac
328
329
330 AC_ARG_ENABLE(endian-check,
331               AC_HELP_STRING([--disable-endian-check],
332               [disable the endian check and trust the OS provided macros]),
333               endiancheck=$enableval,endiancheck=yes)
334 if test x"$endiancheck" = xyes ; then
335   AC_C_BIGENDIAN
336 else
337   AC_DEFINE(DISABLED_ENDIAN_CHECK,1,[configure did not test for endianess])
338 fi
339
340 AC_CHECK_SIZEOF(unsigned short, 2)
341 AC_CHECK_SIZEOF(unsigned int, 4)
342 AC_CHECK_SIZEOF(unsigned long, 4)
343 AC_CHECK_SIZEOF(unsigned long long, 0)
344
345 AC_TYPE_UINTPTR_T
346
347 if test "$ac_cv_sizeof_unsigned_short" = "0" \
348    || test "$ac_cv_sizeof_unsigned_int" = "0" \
349    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
350     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
351 fi
352
353 # Ensure that we have UINT64_C before we bother to check for uint64_t
354 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
355    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <inttypes.h>]],
356        [[uint64_t foo=UINT64_C(42);]])],
357      gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
358 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
359    AC_CHECK_SIZEOF(uint64_t)
360 fi
361
362 # Do we have any 64-bit data types?
363 if test "$ac_cv_sizeof_unsigned_int" != "8" \
364    && test "$ac_cv_sizeof_unsigned_long" != "8" \
365    && test "$ac_cv_sizeof_unsigned_long_long" != "8" \
366    && test "$ac_cv_sizeof_uint64_t" != "8"; then
367     AC_MSG_WARN([No 64-bit types.  Disabling TIGER/192, SCRYPT, SHA-384, \
368  SHA-512 and GOST R 34.11-12])
369 else
370   available_digests="$available_digests $available_digests_64"
371   available_kdfs="$available_kdfs $available_kdfs_64"
372 fi
373
374 # If not specified otherwise, all available algorithms will be
375 # included.
376 default_ciphers="$available_ciphers"
377 default_pubkey_ciphers="$available_pubkey_ciphers"
378 default_digests="$available_digests"
379 default_kdfs="$available_kdfs"
380 # Blacklist MD2 by default
381 default_digests=`echo $default_digests | sed -e 's/md2//g'`
382
383 # Substitutions to set generated files in a Emacs buffer to read-only.
384 AC_SUBST(emacs_local_vars_begin, ['Local Variables:'])
385 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
386 AC_SUBST(emacs_local_vars_end, ['End:'])
387
388 ############################
389 ## Command line switches. ##
390 ############################
391
392 # Implementation of the --enable-ciphers switch.
393 AC_ARG_ENABLE(ciphers,
394               AC_HELP_STRING([--enable-ciphers=ciphers],
395                              [select the symmetric ciphers to include]),
396               [enabled_ciphers=`echo $enableval | tr ',:' '  ' | tr '[A-Z]' '[a-z]'`],
397               [enabled_ciphers=""])
398 if test "x$enabled_ciphers" = "x" \
399    -o "$enabled_ciphers" = "yes"  \
400    -o "$enabled_ciphers" = "no"; then
401    enabled_ciphers=$default_ciphers
402 fi
403 AC_MSG_CHECKING([which symmetric ciphers to include])
404 for cipher in $enabled_ciphers; do
405     LIST_MEMBER($cipher, $available_ciphers)
406     if test "$found" = "0"; then
407        AC_MSG_ERROR([unsupported cipher "$cipher" specified])
408     fi
409 done
410 AC_MSG_RESULT([$enabled_ciphers])
411
412 # Implementation of the --enable-pubkey-ciphers switch.
413 AC_ARG_ENABLE(pubkey-ciphers,
414               AC_HELP_STRING([--enable-pubkey-ciphers=ciphers],
415                              [select the public-key ciphers to include]),
416               [enabled_pubkey_ciphers=`echo $enableval | tr ',:' '  ' | tr '[A-Z]' '[a-z]'`],
417               [enabled_pubkey_ciphers=""])
418 if test "x$enabled_pubkey_ciphers" = "x" \
419    -o "$enabled_pubkey_ciphers" = "yes"  \
420    -o "$enabled_pubkey_ciphers" = "no"; then
421    enabled_pubkey_ciphers=$default_pubkey_ciphers
422 fi
423 AC_MSG_CHECKING([which public-key ciphers to include])
424 for cipher in $enabled_pubkey_ciphers; do
425     LIST_MEMBER($cipher, $available_pubkey_ciphers)
426     if test "$found" = "0"; then
427        AC_MSG_ERROR([unsupported public-key cipher specified])
428     fi
429 done
430 AC_MSG_RESULT([$enabled_pubkey_ciphers])
431
432 # Implementation of the --enable-digests switch.
433 AC_ARG_ENABLE(digests,
434               AC_HELP_STRING([--enable-digests=digests],
435                              [select the message digests to include]),
436               [enabled_digests=`echo $enableval | tr ',:' '  ' | tr '[A-Z]' '[a-z]'`],
437               [enabled_digests=""])
438 if test "x$enabled_digests" = "x" \
439    -o "$enabled_digests" = "yes"  \
440    -o "$enabled_digests" = "no"; then
441    enabled_digests=$default_digests
442 fi
443 AC_MSG_CHECKING([which message digests to include])
444 for digest in $enabled_digests; do
445     LIST_MEMBER($digest, $available_digests)
446     if test "$found" = "0"; then
447        AC_MSG_ERROR([unsupported message digest specified])
448     fi
449 done
450 AC_MSG_RESULT([$enabled_digests])
451
452 # Implementation of the --enable-kdfs switch.
453 AC_ARG_ENABLE(kdfs,
454       AC_HELP_STRING([--enable-kfds=kdfs],
455                      [select the KDFs to include]),
456       [enabled_kdfs=`echo $enableval | tr ',:' '  ' | tr '[A-Z]' '[a-z]'`],
457       [enabled_kdfs=""])
458 if test "x$enabled_kdfs" = "x" \
459    -o "$enabled_kdfs" = "yes"  \
460    -o "$enabled_kdfs" = "no"; then
461    enabled_kdfs=$default_kdfs
462 fi
463 AC_MSG_CHECKING([which key derivation functions to include])
464 for kdf in $enabled_kdfs; do
465     LIST_MEMBER($kdf, $available_kdfs)
466     if test "$found" = "0"; then
467        AC_MSG_ERROR([unsupported key derivation function specified])
468     fi
469 done
470 AC_MSG_RESULT([$enabled_kdfs])
471
472 # Implementation of the --enable-random switch.
473 AC_ARG_ENABLE(random,
474               AC_HELP_STRING([--enable-random=name],
475                              [select which random number generator to use]),
476               [random=`echo $enableval | tr '[A-Z]' '[a-z]'`],
477               [])
478 if test "x$random" = "x" -o "$random" = "yes" -o "$random" = "no"; then
479     random=default
480 fi
481 AC_MSG_CHECKING([which random module to use])
482 if test "$random" != "default" -a "$random" != "auto"; then
483     LIST_MEMBER($random, $available_random_modules)
484     if test "$found" = "0"; then
485        AC_MSG_ERROR([unsupported random module specified])
486     fi
487 fi
488 AC_MSG_RESULT($random)
489
490 # Implementation of the --disable-dev-random switch.
491 AC_MSG_CHECKING([whether use of /dev/random is requested])
492 AC_ARG_ENABLE(dev-random,
493 [  --disable-dev-random    disable the use of dev random],
494     try_dev_random=$enableval, try_dev_random=yes)
495 AC_MSG_RESULT($try_dev_random)
496
497 # Implementation of the --with-egd-socket switch.
498 AC_ARG_WITH(egd-socket,
499     [  --with-egd-socket=NAME  Use NAME for the EGD socket)],
500             egd_socket_name="$withval", egd_socket_name="" )
501 AC_DEFINE_UNQUOTED(EGD_SOCKET_NAME, "$egd_socket_name",
502                    [Define if you don't want the default EGD socket name.
503                     For details see cipher/rndegd.c])
504
505 # Implementation of the --enable-random-daemon
506 AC_MSG_CHECKING([whether the experimental random daemon is requested])
507 AC_ARG_ENABLE([random-daemon],
508               AC_HELP_STRING([--enable-random-daemon],
509                              [Build and support the experimental gcryptrnd]),
510               [use_random_daemon=$enableval],
511               [use_random_daemon=no])
512 AC_MSG_RESULT($use_random_daemon)
513 if test x$use_random_daemon = xyes ; then
514     AC_DEFINE(USE_RANDOM_DAEMON,1,
515               [Define to support the experimental random daemon])
516 fi
517 AM_CONDITIONAL(USE_RANDOM_DAEMON, test x$use_random_daemon = xyes)
518
519
520 # Implementation of --disable-asm.
521 AC_MSG_CHECKING([whether MPI assembler modules are requested])
522 AC_ARG_ENABLE([asm],
523               AC_HELP_STRING([--disable-asm],
524                              [Disable MPI assembler modules]),
525               [try_asm_modules=$enableval],
526               [try_asm_modules=yes])
527 AC_MSG_RESULT($try_asm_modules)
528
529 # Implementation of the --enable-m-guard switch.
530 AC_MSG_CHECKING([whether memory guard is requested])
531 AC_ARG_ENABLE(m-guard,
532               AC_HELP_STRING([--enable-m-guard],
533                              [Enable memory guard facility]),
534               [use_m_guard=$enableval], [use_m_guard=no])
535 AC_MSG_RESULT($use_m_guard)
536 if test "$use_m_guard" = yes ; then
537     AC_DEFINE(M_GUARD,1,[Define to use the (obsolete) malloc guarding feature])
538 fi
539
540 # Implementation of the --enable-large-data-tests switch.
541 AC_MSG_CHECKING([whether to run large data tests])
542 AC_ARG_ENABLE(large-data-tests,
543               AC_HELP_STRING([--enable-large-data-tests],
544                  [Enable the real long ruinning large data tests]),
545               large_data_tests=$enableval,large_data_tests=no)
546 AC_MSG_RESULT($large_data_tests)
547 AC_SUBST(RUN_LARGE_DATA_TESTS, $large_data_tests)
548
549
550 # Implementation of the --with-capabilities switch.
551 # Check whether we want to use Linux capabilities
552 AC_MSG_CHECKING([whether use of capabilities is requested])
553 AC_ARG_WITH(capabilities,
554             AC_HELP_STRING([--with-capabilities],
555                            [Use linux capabilities [default=no]]),
556             [use_capabilities="$withval"],[use_capabilities=no])
557 AC_MSG_RESULT($use_capabilities)
558
559 # Implementation of the --enable-hmac-binary-check.
560 AC_MSG_CHECKING([whether a HMAC binary check is requested])
561 AC_ARG_ENABLE(hmac-binary-check,
562               AC_HELP_STRING([--enable-hmac-binary-check],
563                              [Enable library integrity check]),
564               [use_hmac_binary_check=$enableval],
565               [use_hmac_binary_check=no])
566 AC_MSG_RESULT($use_hmac_binary_check)
567 if test "$use_hmac_binary_check" = yes ; then
568     AC_DEFINE(ENABLE_HMAC_BINARY_CHECK,1,
569               [Define to support an HMAC based integrity check])
570 fi
571
572
573 # Implementation of the --disable-padlock-support switch.
574 AC_MSG_CHECKING([whether padlock support is requested])
575 AC_ARG_ENABLE(padlock-support,
576               AC_HELP_STRING([--disable-padlock-support],
577                  [Disable support for the PadLock Engine of VIA processors]),
578               padlocksupport=$enableval,padlocksupport=yes)
579 AC_MSG_RESULT($padlocksupport)
580
581 # Implementation of the --disable-aesni-support switch.
582 AC_MSG_CHECKING([whether AESNI support is requested])
583 AC_ARG_ENABLE(aesni-support,
584               AC_HELP_STRING([--disable-aesni-support],
585                  [Disable support for the Intel AES-NI instructions]),
586               aesnisupport=$enableval,aesnisupport=yes)
587 AC_MSG_RESULT($aesnisupport)
588
589 # Implementation of the --disable-pclmul-support switch.
590 AC_MSG_CHECKING([whether PCLMUL support is requested])
591 AC_ARG_ENABLE(pclmul-support,
592               AC_HELP_STRING([--disable-pclmul-support],
593                  [Disable support for the Intel PCLMUL instructions]),
594               pclmulsupport=$enableval,pclmulsupport=yes)
595 AC_MSG_RESULT($pclmulsupport)
596
597 # Implementation of the --disable-drng-support switch.
598 AC_MSG_CHECKING([whether DRNG support is requested])
599 AC_ARG_ENABLE(drng-support,
600               AC_HELP_STRING([--disable-drng-support],
601                  [Disable support for the Intel DRNG (RDRAND instruction)]),
602               drngsupport=$enableval,drngsupport=yes)
603 AC_MSG_RESULT($drngsupport)
604
605 # Implementation of the --disable-avx-support switch.
606 AC_MSG_CHECKING([whether AVX support is requested])
607 AC_ARG_ENABLE(avx-support,
608               AC_HELP_STRING([--disable-avx-support],
609                  [Disable support for the Intel AVX instructions]),
610               avxsupport=$enableval,avxsupport=yes)
611 AC_MSG_RESULT($avxsupport)
612
613 # Implementation of the --disable-avx2-support switch.
614 AC_MSG_CHECKING([whether AVX2 support is requested])
615 AC_ARG_ENABLE(avx2-support,
616               AC_HELP_STRING([--disable-avx2-support],
617                  [Disable support for the Intel AVX2 instructions]),
618               avx2support=$enableval,avx2support=yes)
619 AC_MSG_RESULT($avx2support)
620
621 # Implementation of the --disable-neon-support switch.
622 AC_MSG_CHECKING([whether NEON support is requested])
623 AC_ARG_ENABLE(neon-support,
624               AC_HELP_STRING([--disable-neon-support],
625                  [Disable support for the ARM NEON instructions]),
626               neonsupport=$enableval,neonsupport=yes)
627 AC_MSG_RESULT($neonsupport)
628
629 # Implementation of the --disable-O-flag-munging switch.
630 AC_MSG_CHECKING([whether a -O flag munging is requested])
631 AC_ARG_ENABLE([O-flag-munging],
632               AC_HELP_STRING([--disable-O-flag-munging],
633                  [Disable modification of the cc -O flag]),
634               [enable_o_flag_munging=$enableval],
635               [enable_o_flag_munging=yes])
636 AC_MSG_RESULT($enable_o_flag_munging)
637 AM_CONDITIONAL(ENABLE_O_FLAG_MUNGING, test "$enable_o_flag_munging" = "yes")
638
639 # Implementation of the --disable-amd64-as-feature-detection switch.
640 AC_MSG_CHECKING([whether to enable AMD64 as(1) feature detection])
641 AC_ARG_ENABLE(amd64-as-feature-detection,
642               AC_HELP_STRING([--disable-amd64-as-feature-detection],
643                  [Disable the auto-detection of AMD64 as(1) features]),
644               amd64_as_feature_detection=$enableval,
645               amd64_as_feature_detection=yes)
646 AC_MSG_RESULT($amd64_as_feature_detection)
647
648
649 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
650                    [A human readable text with the name of the OS])
651
652 # For some systems we know that we have ld_version scripts.
653 # Use it then as default.
654 have_ld_version_script=no
655 case "${host}" in
656     *-*-linux*)
657         have_ld_version_script=yes
658         ;;
659     *-*-gnu*)
660         have_ld_version_script=yes
661         ;;
662 esac
663 AC_ARG_ENABLE([ld-version-script],
664               AC_HELP_STRING([--enable-ld-version-script],
665                              [enable/disable use of linker version script.
666                               (default is system dependent)]),
667               [have_ld_version_script=$enableval],
668               [ : ] )
669 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
670
671 AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, "$NAME_OF_DEV_RANDOM",
672                    [defined to the name of the strong random device])
673 AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, "$NAME_OF_DEV_URANDOM",
674                    [defined to the name of the weaker random device])
675
676
677 ###############################
678 #### Checks for libraries. ####
679 ###############################
680
681 #
682 # gpg-error is required.
683 #
684 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION")
685 if test "x$GPG_ERROR_LIBS" = "x"; then
686   AC_MSG_ERROR([libgpg-error is needed.
687                 See ftp://ftp.gnupg.org/gcrypt/libgpg-error/ .])
688 fi
689
690 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GCRYPT,
691           [The default error source for libgcrypt.])
692
693 #
694 # Check whether the GNU Pth library is available.  We require this
695 # to build the optional gcryptrnd program.
696 #
697 AC_ARG_WITH(pth-prefix,
698             AC_HELP_STRING([--with-pth-prefix=PFX],
699                            [prefix where GNU Pth is installed (optional)]),
700      pth_config_prefix="$withval", pth_config_prefix="")
701 if test x$pth_config_prefix != x ; then
702    PTH_CONFIG="$pth_config_prefix/bin/pth-config"
703 fi
704 if test "$use_random_daemon" = "yes"; then
705   AC_PATH_PROG(PTH_CONFIG, pth-config, no)
706   if test "$PTH_CONFIG" = "no"; then
707     AC_MSG_WARN([[
708 ***
709 *** To build the Libgcrypt's random number daemon
710 *** we need the support of the GNU Portable Threads Library.
711 *** Download it from ftp://ftp.gnu.org/gnu/pth/
712 *** On a Debian GNU/Linux system you might want to try
713 ***   apt-get install libpth-dev
714 ***]])
715   else
716     GNUPG_PTH_VERSION_CHECK([1.3.7])
717     if test $have_pth = yes; then
718        PTH_CFLAGS=`$PTH_CONFIG --cflags`
719        PTH_LIBS=`$PTH_CONFIG --ldflags`
720        PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`"
721        AC_DEFINE(USE_GNU_PTH, 1,
722                 [Defined if the GNU Portable Thread Library should be used])
723        AC_DEFINE(HAVE_PTH, 1,
724                 [Defined if the GNU Pth is available])
725     fi
726   fi
727 fi
728 AC_SUBST(PTH_CFLAGS)
729 AC_SUBST(PTH_LIBS)
730
731 #
732 # Check whether pthreads is available
733 #
734 if test "$have_w32_system" != yes; then
735   AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
736   if test "$have_pthread" = yes; then
737     AC_DEFINE(HAVE_PTHREAD, 1 ,[Define if we have pthread.])
738   fi
739 fi
740
741
742 # Solaris needs -lsocket and -lnsl. Unisys system includes
743 # gethostbyname in libsocket but needs libnsl for socket.
744 AC_SEARCH_LIBS(setsockopt, [socket], ,
745         [AC_SEARCH_LIBS(setsockopt, [socket], , , [-lnsl])])
746 AC_SEARCH_LIBS(setsockopt, [nsl])
747
748 ##################################
749 #### Checks for header files. ####
750 ##################################
751
752 AC_HEADER_STDC
753 AC_CHECK_HEADERS(unistd.h sys/select.h sys/msg.h)
754 INSERT_SYS_SELECT_H=
755 if test x"$ac_cv_header_sys_select_h" = xyes; then
756   INSERT_SYS_SELECT_H=" include <sys/select.h>"
757 fi
758 AC_SUBST(INSERT_SYS_SELECT_H)
759
760
761 ##########################################
762 #### Checks for typedefs, structures, ####
763 ####  and compiler characteristics.   ####
764 ##########################################
765
766 AC_C_CONST
767 AC_C_INLINE
768 AC_TYPE_SIZE_T
769 AC_TYPE_SIGNAL
770 AC_DECL_SYS_SIGLIST
771 AC_TYPE_PID_T
772
773 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
774 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
775 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
776 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
777 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
778
779 gl_TYPE_SOCKLEN_T
780 case "${host}" in
781   *-*-mingw32*)
782     # socklen_t may or may not be defined depending on what headers
783     # are included.  To be safe we use int as this is the actual type.
784     FALLBACK_SOCKLEN_T="typedef int gcry_socklen_t;"
785     ;;
786   *)
787     if test ".$gl_cv_socklen_t_equiv" = "."; then
788       FALLBACK_SOCKLEN_T="typedef socklen_t gcry_socklen_t;"
789     else
790       FALLBACK_SOCKLEN_T="typedef ${gl_cv_socklen_t_equiv} gcry_socklen_t;"
791     fi
792 esac
793 AC_SUBST(FALLBACK_SOCKLEN_T)
794
795
796 #
797 # Check for __builtin_bswap32 intrinsic.
798 #
799 AC_CACHE_CHECK(for __builtin_bswap32,
800        [gcry_cv_have_builtin_bswap32],
801        [gcry_cv_have_builtin_bswap32=no
802         AC_LINK_IFELSE([AC_LANG_PROGRAM([],
803           [int x = 0; int y = __builtin_bswap32(x); return y;])],
804           [gcry_cv_have_builtin_bswap32=yes])])
805 if test "$gcry_cv_have_builtin_bswap32" = "yes" ; then
806    AC_DEFINE(HAVE_BUILTIN_BSWAP32,1,
807              [Defined if compiler has '__builtin_bswap32' intrinsic])
808 fi
809
810
811 #
812 # Check for __builtin_bswap64 intrinsic.
813 #
814 AC_CACHE_CHECK(for __builtin_bswap64,
815        [gcry_cv_have_builtin_bswap64],
816        [gcry_cv_have_builtin_bswap64=no
817         AC_LINK_IFELSE([AC_LANG_PROGRAM([],
818           [long long x = 0; long long y = __builtin_bswap64(x); return y;])],
819           [gcry_cv_have_builtin_bswap64=yes])])
820 if test "$gcry_cv_have_builtin_bswap64" = "yes" ; then
821    AC_DEFINE(HAVE_BUILTIN_BSWAP64,1,
822              [Defined if compiler has '__builtin_bswap64' intrinsic])
823 fi
824
825
826 #
827 # Check for VLA support (variable length arrays).
828 #
829 AC_CACHE_CHECK(whether the variable length arrays are supported,
830        [gcry_cv_have_vla],
831        [gcry_cv_have_vla=no
832         AC_COMPILE_IFELSE([AC_LANG_SOURCE(
833           [[void f1(char *, int);
834             char foo(int i) {
835               char b[(i < 0 ? 0 : i) + 1];
836               f1(b, sizeof b); return b[0];}]])],
837           [gcry_cv_have_vla=yes])])
838 if test "$gcry_cv_have_vla" = "yes" ; then
839    AC_DEFINE(HAVE_VLA,1, [Defined if variable length arrays are supported])
840 fi
841
842
843 #
844 # Check for ELF visibility support.
845 #
846 AC_CACHE_CHECK(whether the visibility attribute is supported,
847        gcry_cv_visibility_attribute,
848        [gcry_cv_visibility_attribute=no
849         AC_LANG_CONFTEST([AC_LANG_SOURCE(
850           [[int foo __attribute__ ((visibility ("hidden"))) = 1;
851             int bar __attribute__ ((visibility ("protected"))) = 1;
852           ]])])
853
854         if ${CC-cc} -Werror -S conftest.c -o conftest.s \
855                   1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
856             if grep '\.hidden.*foo' conftest.s >/dev/null 2>&1 ; then
857                 if grep '\.protected.*bar' conftest.s >/dev/null 2>&1; then
858                     gcry_cv_visibility_attribute=yes
859                 fi
860             fi
861         fi
862        ])
863 if test "$gcry_cv_visibility_attribute" = "yes"; then
864     AC_CACHE_CHECK(for broken visibility attribute,
865        gcry_cv_broken_visibility_attribute,
866        [gcry_cv_broken_visibility_attribute=yes
867         AC_LANG_CONFTEST([AC_LANG_SOURCE(
868           [[int foo (int x);
869             int bar (int x) __asm__ ("foo")
870                             __attribute__ ((visibility ("hidden")));
871             int bar (int x) { return x; }
872           ]])])
873
874         if ${CC-cc} -Werror -S conftest.c -o conftest.s \
875                   1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
876            if grep '\.hidden@<:@        _@:>@foo' conftest.s >/dev/null 2>&1;
877             then
878                gcry_cv_broken_visibility_attribute=no
879            fi
880         fi
881        ])
882 fi
883 if test "$gcry_cv_visibility_attribute" = "yes"; then
884     AC_CACHE_CHECK(for broken alias attribute,
885        gcry_cv_broken_alias_attribute,
886        [gcry_cv_broken_alias_attribute=yes
887         AC_LANG_CONFTEST([AC_LANG_SOURCE(
888           [[extern int foo (int x) __asm ("xyzzy");
889             int bar (int x) { return x; }
890             extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
891             extern int dfoo;
892             extern __typeof (dfoo) dfoo __asm ("abccb");
893             int dfoo = 1;
894           ]])])
895
896         if ${CC-cc} -Werror -S conftest.c -o conftest.s \
897                   1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
898            if grep 'xyzzy' conftest.s >/dev/null 2>&1 && \
899               grep 'abccb' conftest.s >/dev/null 2>&1; then
900               gcry_cv_broken_alias_attribute=no
901            fi
902         fi
903         ])
904 fi
905 if test "$gcry_cv_visibility_attribute" = "yes"; then
906     AC_CACHE_CHECK(if gcc supports -fvisibility=hidden,
907        gcry_cv_gcc_has_f_visibility,
908        [gcry_cv_gcc_has_f_visibility=no
909         _gcc_cflags_save=$CFLAGS
910         CFLAGS="-fvisibility=hidden"
911         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
912                           gcry_cv_gcc_has_f_visibility=yes)
913         CFLAGS=$_gcc_cflags_save;
914        ])
915 fi
916 if test "$gcry_cv_visibility_attribute" = "yes" \
917    && test "$gcry_cv_broken_visibility_attribute" != "yes" \
918    && test "$gcry_cv_broken_alias_attribute" != "yes" \
919    && test "$gcry_cv_gcc_has_f_visibility" = "yes"
920  then
921    AC_DEFINE(GCRY_USE_VISIBILITY, 1,
922                [Define to use the GNU C visibility attribute.])
923    CFLAGS="$CFLAGS -fvisibility=hidden"
924 fi
925
926
927 #
928 # Check whether the compiler supports the GCC style aligned attribute
929 #
930 AC_CACHE_CHECK([whether the GCC style aligned attribute is supported],
931        [gcry_cv_gcc_attribute_aligned],
932        [gcry_cv_gcc_attribute_aligned=no
933         AC_COMPILE_IFELSE([AC_LANG_SOURCE(
934           [[struct { int a; } foo __attribute__ ((aligned (16)));]])],
935           [gcry_cv_gcc_attribute_aligned=yes])])
936 if test "$gcry_cv_gcc_attribute_aligned" = "yes" ; then
937    AC_DEFINE(HAVE_GCC_ATTRIBUTE_ALIGNED,1,
938      [Defined if a GCC style "__attribute__ ((aligned (n))" is supported])
939 fi
940
941
942 #
943 # Check whether the compiler supports 'asm' or '__asm__' keyword for
944 # assembler blocks.
945 #
946 AC_CACHE_CHECK([whether 'asm' assembler keyword is supported],
947        [gcry_cv_have_asm],
948        [gcry_cv_have_asm=no
949         AC_COMPILE_IFELSE([AC_LANG_SOURCE(
950           [[void a(void) { asm("":::"memory"); }]])],
951           [gcry_cv_have_asm=yes])])
952 AC_CACHE_CHECK([whether '__asm__' assembler keyword is supported],
953        [gcry_cv_have___asm__],
954        [gcry_cv_have___asm__=no
955         AC_COMPILE_IFELSE([AC_LANG_SOURCE(
956           [[void a(void) { __asm__("":::"memory"); }]])],
957           [gcry_cv_have___asm__=yes])])
958 if test "$gcry_cv_have_asm" = "no" ; then
959    if test "$gcry_cv_have___asm__" = "yes" ; then
960       AC_DEFINE(asm,__asm__,
961         [Define to supported assembler block keyword, if plain 'asm' was not
962          supported])
963    fi
964 fi
965
966
967 #
968 # Check whether the compiler supports inline assembly memory barrier.
969 #
970 if test "$gcry_cv_have_asm" = "no" ; then
971    if test "$gcry_cv_have___asm__" = "yes" ; then
972       AC_CACHE_CHECK([whether inline assembly memory barrier is supported],
973           [gcry_cv_have_asm_volatile_memory],
974           [gcry_cv_have_asm_volatile_memory=no
975            AC_COMPILE_IFELSE([AC_LANG_SOURCE(
976              [[void a(void) { __asm__ volatile("":::"memory"); }]])],
977              [gcry_cv_have_asm_volatile_memory=yes])])
978    fi
979 else
980    AC_CACHE_CHECK([whether inline assembly memory barrier is supported],
981        [gcry_cv_have_asm_volatile_memory],
982        [gcry_cv_have_asm_volatile_memory=no
983         AC_COMPILE_IFELSE([AC_LANG_SOURCE(
984           [[void a(void) { asm volatile("":::"memory"); }]])],
985           [gcry_cv_have_asm_volatile_memory=yes])])
986 fi
987 if test "$gcry_cv_have_asm_volatile_memory" = "yes" ; then
988    AC_DEFINE(HAVE_GCC_ASM_VOLATILE_MEMORY,1,
989      [Define if inline asm memory barrier is supported])
990 fi
991
992
993 #
994 # Check whether GCC assembler supports features needed for our ARM
995 # implementations.  This needs to be done before setting up the
996 # assembler stuff.
997 #
998 AC_CACHE_CHECK([whether GCC assembler is compatible for ARM assembly implementations],
999        [gcry_cv_gcc_arm_platform_as_ok],
1000        [gcry_cv_gcc_arm_platform_as_ok=no
1001         AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1002           [[__asm__(
1003                 /* Test if assembler supports UAL syntax.  */
1004                 ".syntax unified\n\t"
1005                 ".arm\n\t" /* our assembly code is in ARM mode  */
1006                 /* Following causes error if assembler ignored '.syntax unified'.  */
1007                 "asmfunc:\n\t"
1008                 "add %r0, %r0, %r4, ror #12;\n\t"
1009
1010                 /* Test if '.type' and '.size' are supported.  */
1011                 ".size asmfunc,.-asmfunc;\n\t"
1012                 ".type asmfunc,%function;\n\t"
1013             );]])],
1014           [gcry_cv_gcc_arm_platform_as_ok=yes])])
1015 if test "$gcry_cv_gcc_arm_platform_as_ok" = "yes" ; then
1016    AC_DEFINE(HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS,1,
1017      [Defined if underlying assembler is compatible with ARM assembly implementations])
1018 fi
1019
1020
1021 #
1022 # Check whether underscores in symbols are required.  This needs to be
1023 # done before setting up the assembler stuff.
1024 #
1025 GNUPG_SYS_SYMBOL_UNDERSCORE()
1026
1027
1028 #################################
1029 ####                         ####
1030 #### Setup assembler stuff.  ####
1031 #### Define mpi_cpu_arch.    ####
1032 ####                         ####
1033 #################################
1034 AC_ARG_ENABLE(mpi-path,
1035               AC_HELP_STRING([--enable-mpi-path=EXTRA_PATH],
1036               [prepend EXTRA_PATH to list of CPU specific optimizations]),
1037               mpi_extra_path="$enableval",mpi_extra_path="")
1038 AC_MSG_CHECKING(architecture and mpi assembler functions)
1039 if test -f $srcdir/mpi/config.links ; then
1040     . $srcdir/mpi/config.links
1041     AC_CONFIG_LINKS("$mpi_ln_list")
1042     ac_cv_mpi_sflags="$mpi_sflags"
1043     AC_MSG_RESULT($mpi_cpu_arch)
1044 else
1045     AC_MSG_RESULT(failed)
1046     AC_MSG_ERROR([mpi/config.links missing!])
1047 fi
1048 MPI_SFLAGS="$ac_cv_mpi_sflags"
1049 AC_SUBST(MPI_SFLAGS)
1050
1051 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_ADD1, test "$mpi_mod_asm_mpih_add1" = yes)
1052 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_SUB1, test "$mpi_mod_asm_mpih_sub1" = yes)
1053 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL1, test "$mpi_mod_asm_mpih_mul1" = yes)
1054 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL2, test "$mpi_mod_asm_mpih_mul2" = yes)
1055 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL3, test "$mpi_mod_asm_mpih_mul3" = yes)
1056 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_LSHIFT, test "$mpi_mod_asm_mpih_lshift" = yes)
1057 AM_CONDITIONAL(MPI_MOD_ASM_MPIH_RSHIFT, test "$mpi_mod_asm_mpih_rshift" = yes)
1058 AM_CONDITIONAL(MPI_MOD_ASM_UDIV, test "$mpi_mod_asm_udiv" = yes)
1059 AM_CONDITIONAL(MPI_MOD_ASM_UDIV_QRNND, test "$mpi_mod_asm_udiv_qrnnd" = yes)
1060 AM_CONDITIONAL(MPI_MOD_C_MPIH_ADD1, test "$mpi_mod_c_mpih_add1" = yes)
1061 AM_CONDITIONAL(MPI_MOD_C_MPIH_SUB1, test "$mpi_mod_c_mpih_sub1" = yes)
1062 AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL1, test "$mpi_mod_c_mpih_mul1" = yes)
1063 AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL2, test "$mpi_mod_c_mpih_mul2" = yes)
1064 AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL3, test "$mpi_mod_c_mpih_mul3" = yes)
1065 AM_CONDITIONAL(MPI_MOD_C_MPIH_LSHIFT, test "$mpi_mod_c_mpih_lshift" = yes)
1066 AM_CONDITIONAL(MPI_MOD_C_MPIH_RSHIFT, test "$mpi_mod_c_mpih_rshift" = yes)
1067 AM_CONDITIONAL(MPI_MOD_C_UDIV, test "$mpi_mod_c_udiv" = yes)
1068 AM_CONDITIONAL(MPI_MOD_C_UDIV_QRNND, test "$mpi_mod_c_udiv_qrnnd" = yes)
1069
1070 # Reset non applicable feature flags.
1071 if test "$mpi_cpu_arch" != "x86" ; then
1072    aesnisupport="n/a"
1073    pclmulsupport="n/a"
1074    avxsupport="n/a"
1075    avx2support="n/a"
1076    padlocksupport="n/a"
1077    drngsupport="n/a"
1078 fi
1079
1080 if test "$mpi_cpu_arch" != "arm" ; then
1081    neonsupport="n/a"
1082 fi
1083
1084
1085 #############################################
1086 ####                                     ####
1087 #### Platform specific compiler checks.  ####
1088 ####                                     ####
1089 #############################################
1090
1091 #
1092 # Check whether GCC inline assembler supports SSSE3 instructions
1093 # This is required for the AES-NI instructions.
1094 #
1095 AC_CACHE_CHECK([whether GCC inline assembler supports SSSE3 instructions],
1096        [gcry_cv_gcc_inline_asm_ssse3],
1097        [if test "$mpi_cpu_arch" != "x86" ; then
1098           gcry_cv_gcc_inline_asm_ssse3="n/a"
1099         else
1100           gcry_cv_gcc_inline_asm_ssse3=no
1101           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1102           [[static unsigned char be_mask[16] __attribute__ ((aligned (16))) =
1103               { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
1104             void a(void) {
1105               __asm__("pshufb %[mask], %%xmm2\n\t"::[mask]"m"(*be_mask):);
1106             }]])],
1107           [gcry_cv_gcc_inline_asm_ssse3=yes])
1108         fi])
1109 if test "$gcry_cv_gcc_inline_asm_ssse3" = "yes" ; then
1110    AC_DEFINE(HAVE_GCC_INLINE_ASM_SSSE3,1,
1111      [Defined if inline assembler supports SSSE3 instructions])
1112 fi
1113
1114
1115 #
1116 # Check whether GCC inline assembler supports PCLMUL instructions.
1117 #
1118 AC_CACHE_CHECK([whether GCC inline assembler supports PCLMUL instructions],
1119        [gcry_cv_gcc_inline_asm_pclmul],
1120        [if test "$mpi_cpu_arch" != "x86" ; then
1121           gcry_cv_gcc_inline_asm_pclmul="n/a"
1122         else
1123           gcry_cv_gcc_inline_asm_pclmul=no
1124           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1125           [[void a(void) {
1126               __asm__("pclmulqdq \$0, %%xmm1, %%xmm3\n\t":::"cc");
1127             }]])],
1128           [gcry_cv_gcc_inline_asm_pclmul=yes])
1129         fi])
1130 if test "$gcry_cv_gcc_inline_asm_pclmul" = "yes" ; then
1131    AC_DEFINE(HAVE_GCC_INLINE_ASM_PCLMUL,1,
1132      [Defined if inline assembler supports PCLMUL instructions])
1133 fi
1134
1135
1136 #
1137 # Check whether GCC inline assembler supports AVX instructions
1138 #
1139 AC_CACHE_CHECK([whether GCC inline assembler supports AVX instructions],
1140        [gcry_cv_gcc_inline_asm_avx],
1141        [if test "$mpi_cpu_arch" != "x86" ; then
1142           gcry_cv_gcc_inline_asm_avx="n/a"
1143         else
1144           gcry_cv_gcc_inline_asm_avx=no
1145           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1146           [[void a(void) {
1147               __asm__("xgetbv; vaesdeclast (%[mem]),%%xmm0,%%xmm7\n\t"::[mem]"r"(0):);
1148             }]])],
1149           [gcry_cv_gcc_inline_asm_avx=yes])
1150         fi])
1151 if test "$gcry_cv_gcc_inline_asm_avx" = "yes" ; then
1152    AC_DEFINE(HAVE_GCC_INLINE_ASM_AVX,1,
1153      [Defined if inline assembler supports AVX instructions])
1154 fi
1155
1156
1157 #
1158 # Check whether GCC inline assembler supports AVX2 instructions
1159 #
1160 AC_CACHE_CHECK([whether GCC inline assembler supports AVX2 instructions],
1161        [gcry_cv_gcc_inline_asm_avx2],
1162        [if test "$mpi_cpu_arch" != "x86" ; then
1163           gcry_cv_gcc_inline_asm_avx2="n/a"
1164         else
1165           gcry_cv_gcc_inline_asm_avx2=no
1166           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1167           [[void a(void) {
1168               __asm__("xgetbv; vpbroadcastb %%xmm7,%%ymm1\n\t":::"cc");
1169             }]])],
1170           [gcry_cv_gcc_inline_asm_avx2=yes])
1171         fi])
1172 if test "$gcry_cv_gcc_inline_asm_avx2" = "yes" ; then
1173    AC_DEFINE(HAVE_GCC_INLINE_ASM_AVX2,1,
1174      [Defined if inline assembler supports AVX2 instructions])
1175 fi
1176
1177
1178 #
1179 # Check whether GCC inline assembler supports BMI2 instructions
1180 #
1181 AC_CACHE_CHECK([whether GCC inline assembler supports BMI2 instructions],
1182        [gcry_cv_gcc_inline_asm_bmi2],
1183        [if test "$mpi_cpu_arch" != "x86" ; then
1184           gcry_cv_gcc_inline_asm_bmi2="n/a"
1185         else
1186           gcry_cv_gcc_inline_asm_bmi2=no
1187           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1188           [[void a(void) {
1189               __asm__("rorxl \$23, %%eax, %%edx\\n\\t":::"memory");
1190             }]])],
1191           [gcry_cv_gcc_inline_asm_bmi2=yes])
1192         fi])
1193 if test "$gcry_cv_gcc_inline_asm_bmi2" = "yes" ; then
1194    AC_DEFINE(HAVE_GCC_INLINE_ASM_BMI2,1,
1195      [Defined if inline assembler supports BMI2 instructions])
1196 fi
1197
1198
1199 #
1200 # Check whether GCC assembler needs "-Wa,--divide" to correctly handle
1201 # constant division
1202 #
1203 if test $amd64_as_feature_detection = yes; then
1204   AC_CACHE_CHECK([whether GCC assembler handles division correctly],
1205        [gcry_cv_gcc_as_const_division_ok],
1206        [gcry_cv_gcc_as_const_division_ok=no
1207         AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1208           [[__asm__("xorl \$(123456789/12345678), %ebp;\n\t");]])],
1209           [gcry_cv_gcc_as_const_division_ok=yes])])
1210   if test "$gcry_cv_gcc_as_const_division_ok" = "no" ; then
1211     #
1212     # Add '-Wa,--divide' to CPPFLAGS and try check again.
1213     #
1214     _gcc_cppflags_save="$CPPFLAGS"
1215     CPPFLAGS="$CPPFLAGS -Wa,--divide"
1216     AC_CACHE_CHECK([whether GCC assembler handles division correctly with "-Wa,--divide"],
1217          [gcry_cv_gcc_as_const_division_with_wadivide_ok],
1218          [gcry_cv_gcc_as_const_division_with_wadivide_ok=no
1219           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1220             [[__asm__("xorl \$(123456789/12345678), %ebp;\n\t");]])],
1221             [gcry_cv_gcc_as_const_division_with_wadivide_ok=yes])])
1222     if test "$gcry_cv_gcc_as_const_division_with_wadivide_ok" = "no" ; then
1223       # '-Wa,--divide' did not work, restore old flags.
1224       CPPFLAGS="$_gcc_cppflags_save"
1225     fi
1226   fi
1227 fi
1228
1229
1230 #
1231 # Check whether GCC assembler supports features needed for our amd64
1232 # implementations
1233 #
1234 if test $amd64_as_feature_detection = yes; then
1235   AC_CACHE_CHECK([whether GCC assembler is compatible for amd64 assembly implementations],
1236        [gcry_cv_gcc_amd64_platform_as_ok],
1237        [if test "$mpi_cpu_arch" != "x86" ; then
1238           gcry_cv_gcc_amd64_platform_as_ok="n/a"
1239         else
1240           gcry_cv_gcc_amd64_platform_as_ok=no
1241           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1242           [[__asm__(
1243                 /* Test if '.type' and '.size' are supported.  */
1244                 /* These work only on ELF targets. */
1245                 /* TODO: add COFF (mingw64, cygwin64) support to assembly
1246                  * implementations.  Mingw64/cygwin64 also require additional
1247                  * work because they use different calling convention. */
1248                 "asmfunc:\n\t"
1249                 ".size asmfunc,.-asmfunc;\n\t"
1250                 ".type asmfunc,@function;\n\t"
1251                 /* Test if assembler allows use of '/' for constant division
1252                  * (Solaris/x86 issue). If previous constant division check
1253                  * and "-Wa,--divide" workaround failed, this causes assembly
1254                  * to be disable on this machine. */
1255                 "xorl \$(123456789/12345678), %ebp;\n\t"
1256             );]])],
1257           [gcry_cv_gcc_amd64_platform_as_ok=yes])
1258         fi])
1259   if test "$gcry_cv_gcc_amd64_platform_as_ok" = "yes" ; then
1260      AC_DEFINE(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS,1,
1261               [Defined if underlying assembler is compatible with amd64 assembly implementations])
1262   fi
1263 fi
1264
1265
1266 #
1267 # Check whether GCC assembler supports features needed for assembly
1268 # implementations that use Intel syntax
1269 #
1270 AC_CACHE_CHECK([whether GCC assembler is compatible for Intel syntax assembly implementations],
1271        [gcry_cv_gcc_platform_as_ok_for_intel_syntax],
1272        [if test "$mpi_cpu_arch" != "x86" ; then
1273           gcry_cv_gcc_platform_as_ok_for_intel_syntax="n/a"
1274         else
1275           gcry_cv_gcc_platform_as_ok_for_intel_syntax=no
1276           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1277           [[__asm__(
1278                 ".intel_syntax noprefix\n\t"
1279                 "pxor xmm1, xmm7;\n\t"
1280                 /* Intel syntax implementation also use GAS macros, so check
1281                  * for them here. */
1282                 "VAL_A = xmm4\n\t"
1283                 "VAL_B = xmm2\n\t"
1284                 ".macro SET_VAL_A p1\n\t"
1285                 "  VAL_A = \\\\p1 \n\t"
1286                 ".endm\n\t"
1287                 ".macro SET_VAL_B p1\n\t"
1288                 "  VAL_B = \\\\p1 \n\t"
1289                 ".endm\n\t"
1290                 "vmovdqa VAL_A, VAL_B;\n\t"
1291                 "SET_VAL_A eax\n\t"
1292                 "SET_VAL_B ebp\n\t"
1293                 "add VAL_A, VAL_B;\n\t"
1294                 "add VAL_B, 0b10101;\n\t"
1295             );]])],
1296           [gcry_cv_gcc_platform_as_ok_for_intel_syntax=yes])
1297         fi])
1298 if test "$gcry_cv_gcc_platform_as_ok_for_intel_syntax" = "yes" ; then
1299   AC_DEFINE(HAVE_INTEL_SYNTAX_PLATFORM_AS,1,
1300             [Defined if underlying assembler is compatible with Intel syntax assembly implementations])
1301 fi
1302
1303
1304 #
1305 # Check whether compiler is configured for ARMv6 or newer architecture
1306 #
1307 AC_CACHE_CHECK([whether compiler is configured for ARMv6 or newer architecture],
1308        [gcry_cv_cc_arm_arch_is_v6],
1309        [if test "$mpi_cpu_arch" != "arm" ; then
1310           gcry_cv_cc_arm_arch_is_v6="n/a"
1311         else
1312           gcry_cv_cc_arm_arch_is_v6=no
1313           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1314           [[
1315            #if defined(__arm__) && \
1316              ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
1317              || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
1318              || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
1319              || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
1320              || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
1321              || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
1322              || defined(__ARM_ARCH_7EM__))
1323              /* empty */
1324            #else
1325              /* fail compile if not ARMv6. */
1326              not_armv6 not_armv6 = (not_armv6)not_armv6;
1327            #endif
1328           ]])],
1329           [gcry_cv_cc_arm_arch_is_v6=yes])
1330         fi])
1331 if test "$gcry_cv_cc_arm_arch_is_v6" = "yes" ; then
1332    AC_DEFINE(HAVE_ARM_ARCH_V6,1,
1333      [Defined if ARM architecture is v6 or newer])
1334 fi
1335
1336
1337 #
1338 # Check whether GCC inline assembler supports NEON instructions
1339 #
1340 AC_CACHE_CHECK([whether GCC inline assembler supports NEON instructions],
1341        [gcry_cv_gcc_inline_asm_neon],
1342        [if test "$mpi_cpu_arch" != "arm" ; then
1343           gcry_cv_gcc_inline_asm_neon="n/a"
1344         else
1345           gcry_cv_gcc_inline_asm_neon=no
1346           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1347           [[__asm__(
1348                 ".syntax unified\n\t"
1349                 ".thumb\n\t"
1350                 ".fpu neon\n\t"
1351                 "vld1.64 {%q0-%q1}, [%r0]!;\n\t"
1352                 "vrev64.8 %q0, %q3;\n\t"
1353                 "vadd.u64 %q0, %q1;\n\t"
1354                 "vadd.s64 %d3, %d2, %d3;\n\t"
1355                 );
1356             ]])],
1357           [gcry_cv_gcc_inline_asm_neon=yes])
1358         fi])
1359 if test "$gcry_cv_gcc_inline_asm_neon" = "yes" ; then
1360    AC_DEFINE(HAVE_GCC_INLINE_ASM_NEON,1,
1361      [Defined if inline assembler supports NEON instructions])
1362 fi
1363
1364
1365 #######################################
1366 #### Checks for library functions. ####
1367 #######################################
1368
1369 AC_FUNC_VPRINTF
1370 # We have replacements for these in src/missing-string.c
1371 AC_CHECK_FUNCS(stpcpy strcasecmp)
1372 # We have replacements for these in src/g10lib.h
1373 AC_CHECK_FUNCS(strtoul memmove stricmp atexit raise)
1374 # Other checks
1375 AC_CHECK_FUNCS(strerror rand mmap getpagesize sysconf waitpid wait4)
1376 AC_CHECK_FUNCS(gettimeofday getrusage gethrtime clock_gettime syslog)
1377 AC_CHECK_FUNCS(fcntl ftruncate flockfile)
1378
1379 GNUPG_CHECK_MLOCK
1380
1381 #
1382 # Replacement functions.
1383 #
1384 AC_REPLACE_FUNCS([getpid clock])
1385
1386
1387 #
1388 # Check wether it is necessary to link against libdl.
1389 #
1390 DL_LIBS=""
1391 if test "$use_hmac_binary_check" = yes ; then
1392   _gcry_save_libs="$LIBS"
1393   LIBS=""
1394   AC_SEARCH_LIBS(dlopen, c dl,,,)
1395   DL_LIBS=$LIBS
1396   LIBS="$_gcry_save_libs"
1397   LIBGCRYPT_CONFIG_LIBS="${LIBGCRYPT_CONFIG_LIBS} ${DL_LIBS}"
1398 fi
1399 AC_SUBST(DL_LIBS)
1400
1401
1402 #
1403 # Check whether we can use Linux capabilities as requested.
1404 #
1405 if test "$use_capabilities" = "yes" ; then
1406 use_capabilities=no
1407 AC_CHECK_HEADERS(sys/capability.h)
1408 if test "$ac_cv_header_sys_capability_h" = "yes" ; then
1409   AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1)
1410   if test "$ac_cv_lib_cap_cap_init" = "yes"; then
1411      AC_DEFINE(USE_CAPABILITIES,1,
1412                [define if capabilities should be used])
1413      LIBS="$LIBS -lcap"
1414      use_capabilities=yes
1415   fi
1416 fi
1417 if test "$use_capabilities" = "no" ; then
1418     AC_MSG_WARN([[
1419 ***
1420 *** The use of capabilities on this system is not possible.
1421 *** You need a recent Linux kernel and some patches:
1422 ***   fcaps-2.2.9-990610.patch      (kernel patch for 2.2.9)
1423 ***   fcap-module-990613.tar.gz     (kernel module)
1424 ***   libcap-1.92.tar.gz            (user mode library and utilities)
1425 *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN
1426 *** set (filesystems menu). Be warned: This code is *really* ALPHA.
1427 ***]])
1428 fi
1429 fi
1430
1431 # Check whether a random device is available.
1432 if test "$try_dev_random" = yes ; then
1433     AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1434     [if test -r "$NAME_OF_DEV_RANDOM" && test -r "$NAME_OF_DEV_URANDOM" ; then
1435       ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
1436     if test "$ac_cv_have_dev_random" = yes; then
1437         AC_DEFINE(HAVE_DEV_RANDOM,1,
1438                  [defined if the system supports a random device] )
1439     fi
1440 else
1441     AC_MSG_CHECKING(for random device)
1442     ac_cv_have_dev_random=no
1443     AC_MSG_RESULT(has been disabled)
1444 fi
1445
1446 # Figure out the random modules for this configuration.
1447 if test "$random" = "default"; then
1448
1449     # Select default value.
1450     if test "$ac_cv_have_dev_random" = yes; then
1451         # Try Linuxish random device.
1452         random_modules="linux"
1453     else
1454         case "${host}" in
1455         *-*-mingw32ce*)
1456           # WindowsCE random device.
1457           random_modules="w32ce"
1458           ;;
1459         *-*-mingw32*|*-*-cygwin*)
1460           # Windows random device.
1461           random_modules="w32"
1462           ;;
1463         *)
1464           # Build everything, allow to select at runtime.
1465           random_modules="$auto_random_modules"
1466           ;;
1467         esac
1468     fi
1469 else
1470     if test "$random" = "auto"; then
1471         # Build everything, allow to select at runtime.
1472         random_modules="$auto_random_modules"
1473     else
1474         random_modules="$random"
1475     fi
1476 fi
1477
1478
1479 #
1480 # Other defines
1481 #
1482 if test mym4_isgit = "yes"; then
1483     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1484               [Defined if this is not a regular release])
1485 fi
1486
1487
1488 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1489
1490
1491 # This is handy for debugging so the compiler doesn't rearrange
1492 # things and eliminate variables.
1493 AC_ARG_ENABLE(optimization,
1494        AC_HELP_STRING([--disable-optimization],
1495                       [disable compiler optimization]),
1496                       [if test $enableval = no ; then
1497                          CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
1498                        fi])
1499
1500 # CFLAGS mangling when using gcc.
1501 if test "$GCC" = yes; then
1502     CFLAGS="$CFLAGS -Wall"
1503     if test "$USE_MAINTAINER_MODE" = "yes"; then
1504         CFLAGS="$CFLAGS -Wcast-align -Wshadow -Wstrict-prototypes"
1505         CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1506
1507         # If -Wno-missing-field-initializers is supported we can enable a
1508         # a bunch of really useful warnings.
1509         AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1510         _gcc_cflags_save=$CFLAGS
1511         CFLAGS="-Wno-missing-field-initializers"
1512         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1513         AC_MSG_RESULT($_gcc_wopt)
1514         CFLAGS=$_gcc_cflags_save;
1515         if test x"$_gcc_wopt" = xyes ; then
1516           CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast"
1517           CFLAGS="$CFLAGS -Wwrite-strings"
1518           CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1519           CFLAGS="$CFLAGS -Wno-missing-field-initializers"
1520           CFLAGS="$CFLAGS -Wno-sign-compare"
1521         fi
1522
1523         AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1524         _gcc_cflags_save=$CFLAGS
1525         CFLAGS="-Wpointer-arith"
1526         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1527         AC_MSG_RESULT($_gcc_wopt)
1528         CFLAGS=$_gcc_cflags_save;
1529         if test x"$_gcc_wopt" = xyes ; then
1530           CFLAGS="$CFLAGS -Wpointer-arith"
1531         fi
1532     fi
1533
1534 fi
1535
1536 # Check whether as(1) supports a noeexecstack feature.  This test
1537 # includes an override option.
1538 CL_AS_NOEXECSTACK
1539
1540
1541 AC_SUBST(LIBGCRYPT_CONFIG_API_VERSION)
1542 AC_SUBST(LIBGCRYPT_CONFIG_LIBS)
1543 AC_SUBST(LIBGCRYPT_CONFIG_CFLAGS)
1544 AC_SUBST(LIBGCRYPT_CONFIG_HOST)
1545 AC_SUBST(LIBGCRYPT_THREAD_MODULES)
1546
1547 AC_CONFIG_COMMANDS([gcrypt-conf],[[
1548 chmod +x src/libgcrypt-config
1549 ]],[[
1550 prefix=$prefix
1551 exec_prefix=$exec_prefix
1552 libdir=$libdir
1553 datadir=$datadir
1554 DATADIRNAME=$DATADIRNAME
1555 ]])
1556
1557 #####################
1558 #### Conclusion. ####
1559 #####################
1560
1561 # Check that requested feature can actually be used and define
1562 # ENABLE_foo_SUPPORT macros.
1563
1564 if test x"$aesnisupport" = xyes ; then
1565   if test "$gcry_cv_gcc_inline_asm_ssse3" != "yes" ; then
1566     aesnisupport="no (unsupported by compiler)"
1567   fi
1568 fi
1569 if test x"$pclmulsupport" = xyes ; then
1570   if test "$gcry_cv_gcc_inline_asm_pclmul" != "yes" ; then
1571     pclmulsupport="no (unsupported by compiler)"
1572   fi
1573 fi
1574 if test x"$avxsupport" = xyes ; then
1575   if test "$gcry_cv_gcc_inline_asm_avx" != "yes" ; then
1576     avxsupport="no (unsupported by compiler)"
1577   fi
1578 fi
1579 if test x"$avx2support" = xyes ; then
1580   if test "$gcry_cv_gcc_inline_asm_avx2" != "yes" ; then
1581     avx2support="no (unsupported by compiler)"
1582   fi
1583 fi
1584 if test x"$neonsupport" = xyes ; then
1585   if test "$gcry_cv_gcc_inline_asm_neon" != "yes" ; then
1586     neonsupport="no (unsupported by compiler)"
1587   fi
1588 fi
1589
1590 if test x"$aesnisupport" = xyes ; then
1591   AC_DEFINE(ENABLE_AESNI_SUPPORT, 1,
1592             [Enable support for Intel AES-NI instructions.])
1593 fi
1594 if test x"$pclmulsupport" = xyes ; then
1595   AC_DEFINE(ENABLE_PCLMUL_SUPPORT, 1,
1596             [Enable support for Intel PCLMUL instructions.])
1597 fi
1598 if test x"$avxsupport" = xyes ; then
1599   AC_DEFINE(ENABLE_AVX_SUPPORT,1,
1600             [Enable support for Intel AVX instructions.])
1601 fi
1602 if test x"$avx2support" = xyes ; then
1603   AC_DEFINE(ENABLE_AVX2_SUPPORT,1,
1604             [Enable support for Intel AVX2 instructions.])
1605 fi
1606 if test x"$neonsupport" = xyes ; then
1607   AC_DEFINE(ENABLE_NEON_SUPPORT,1,
1608             [Enable support for ARM NEON instructions.])
1609 fi
1610 if test x"$padlocksupport" = xyes ; then
1611   AC_DEFINE(ENABLE_PADLOCK_SUPPORT, 1,
1612             [Enable support for the PadLock engine.])
1613 fi
1614 if test x"$drngsupport" = xyes ; then
1615   AC_DEFINE(ENABLE_DRNG_SUPPORT, 1,
1616             [Enable support for Intel DRNG (RDRAND instruction).])
1617 fi
1618
1619
1620 # Define conditional sources and config.h symbols depending on the
1621 # selected ciphers, pubkey-ciphers, digests, kdfs, and random modules.
1622
1623 LIST_MEMBER(arcfour, $enabled_ciphers)
1624 if test "$found" = "1"; then
1625    GCRYPT_CIPHERS="$GCRYPT_CIPHERS arcfour.lo"
1626    AC_DEFINE(USE_ARCFOUR, 1, [Defined if this module should be included])
1627
1628    case "${host}" in
1629       x86_64-*-*)
1630          # Build with the assembly implementation
1631          GCRYPT_CIPHERS="$GCRYPT_CIPHERS arcfour-amd64.lo"
1632       ;;
1633    esac
1634 fi
1635
1636 LIST_MEMBER(blowfish, $enabled_ciphers)
1637 if test "$found" = "1" ; then
1638    GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish.lo"
1639    AC_DEFINE(USE_BLOWFISH, 1, [Defined if this module should be included])
1640
1641    case "${host}" in
1642       x86_64-*-*)
1643          # Build with the assembly implementation
1644          GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish-amd64.lo"
1645       ;;
1646       arm*-*-*)
1647          # Build with the assembly implementation
1648          GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish-arm.lo"
1649       ;;
1650    esac
1651 fi
1652
1653 LIST_MEMBER(cast5, $enabled_ciphers)
1654 if test "$found" = "1" ; then
1655    GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5.lo"
1656    AC_DEFINE(USE_CAST5, 1, [Defined if this module should be included])
1657
1658    case "${host}" in
1659       x86_64-*-*)
1660          # Build with the assembly implementation
1661          GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5-amd64.lo"
1662       ;;
1663       arm*-*-*)
1664          # Build with the assembly implementation
1665          GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5-arm.lo"
1666       ;;
1667    esac
1668 fi
1669
1670 LIST_MEMBER(des, $enabled_ciphers)
1671 if test "$found" = "1" ; then
1672    GCRYPT_CIPHERS="$GCRYPT_CIPHERS des.lo"
1673    AC_DEFINE(USE_DES, 1, [Defined if this module should be included])
1674 fi
1675
1676 LIST_MEMBER(aes, $enabled_ciphers)
1677 if test "$found" = "1" ; then
1678    GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael.lo"
1679    AC_DEFINE(USE_AES, 1, [Defined if this module should be included])
1680
1681    case "${host}" in
1682       x86_64-*-*)
1683          # Build with the assembly implementation
1684          GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-amd64.lo"
1685       ;;
1686       arm*-*-*)
1687          # Build with the assembly implementation
1688          GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-arm.lo"
1689       ;;
1690    esac
1691 fi
1692
1693 LIST_MEMBER(twofish, $enabled_ciphers)
1694 if test "$found" = "1" ; then
1695    GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish.lo"
1696    AC_DEFINE(USE_TWOFISH, 1, [Defined if this module should be included])
1697
1698    case "${host}" in
1699       x86_64-*-*)
1700          # Build with the assembly implementation
1701          GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish-amd64.lo"
1702       ;;
1703       arm*-*-*)
1704          # Build with the assembly implementation
1705          GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish-arm.lo"
1706       ;;
1707    esac
1708 fi
1709
1710 LIST_MEMBER(serpent, $enabled_ciphers)
1711 if test "$found" = "1" ; then
1712    GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent.lo"
1713    AC_DEFINE(USE_SERPENT, 1, [Defined if this module should be included])
1714
1715    case "${host}" in
1716       x86_64-*-*)
1717          # Build with the SSE2 implementation
1718          GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent-sse2-amd64.lo"
1719       ;;
1720    esac
1721
1722    if test x"$avx2support" = xyes ; then
1723       # Build with the AVX2 implementation
1724       GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent-avx2-amd64.lo"
1725    fi
1726
1727    if test x"$neonsupport" = xyes ; then
1728       # Build with the NEON implementation
1729       GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent-armv7-neon.lo"
1730    fi
1731 fi
1732
1733 LIST_MEMBER(rfc2268, $enabled_ciphers)
1734 if test "$found" = "1" ; then
1735    GCRYPT_CIPHERS="$GCRYPT_CIPHERS rfc2268.lo"
1736    AC_DEFINE(USE_RFC2268, 1, [Defined if this module should be included])
1737 fi
1738
1739 LIST_MEMBER(seed, $enabled_ciphers)
1740 if test "$found" = "1" ; then
1741    GCRYPT_CIPHERS="$GCRYPT_CIPHERS seed.lo"
1742    AC_DEFINE(USE_SEED, 1, [Defined if this module should be included])
1743 fi
1744
1745 LIST_MEMBER(camellia, $enabled_ciphers)
1746 if test "$found" = "1" ; then
1747    GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia.lo camellia-glue.lo"
1748    AC_DEFINE(USE_CAMELLIA, 1, [Defined if this module should be included])
1749
1750    case "${host}" in
1751       arm*-*-*)
1752          # Build with the assembly implementation
1753          GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-arm.lo"
1754       ;;
1755    esac
1756
1757    if test x"$avxsupport" = xyes ; then
1758       if test x"$aesnisupport" = xyes ; then
1759         # Build with the AES-NI/AVX implementation
1760         GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-aesni-avx-amd64.lo"
1761       fi
1762    fi
1763
1764    if test x"$avx2support" = xyes ; then
1765       if test x"$aesnisupport" = xyes ; then
1766         # Build with the AES-NI/AVX2 implementation
1767         GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-aesni-avx2-amd64.lo"
1768       fi
1769    fi
1770 fi
1771
1772 LIST_MEMBER(idea, $enabled_ciphers)
1773 if test "$found" = "1" ; then
1774    GCRYPT_CIPHERS="$GCRYPT_CIPHERS idea.lo"
1775    AC_DEFINE(USE_IDEA, 1, [Defined if this module should be included])
1776 fi
1777
1778 LIST_MEMBER(salsa20, $enabled_ciphers)
1779 if test "$found" = "1" ; then
1780    GCRYPT_CIPHERS="$GCRYPT_CIPHERS salsa20.lo"
1781    AC_DEFINE(USE_SALSA20, 1, [Defined if this module should be included])
1782
1783    case "${host}" in
1784       x86_64-*-*)
1785          # Build with the assembly implementation
1786          GCRYPT_CIPHERS="$GCRYPT_CIPHERS salsa20-amd64.lo"
1787       ;;
1788    esac
1789
1790    if test x"$neonsupport" = xyes ; then
1791      # Build with the NEON implementation
1792      GCRYPT_CIPHERS="$GCRYPT_CIPHERS salsa20-armv7-neon.lo"
1793    fi
1794 fi
1795
1796 LIST_MEMBER(gost28147, $enabled_ciphers)
1797 if test "$found" = "1" ; then
1798    GCRYPT_CIPHERS="$GCRYPT_CIPHERS gost28147.lo"
1799    AC_DEFINE(USE_GOST28147, 1, [Defined if this module should be included])
1800 fi
1801
1802 LIST_MEMBER(dsa, $enabled_pubkey_ciphers)
1803 if test "$found" = "1" ; then
1804    GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS dsa.lo"
1805    AC_DEFINE(USE_DSA, 1, [Defined if this module should be included])
1806 fi
1807
1808 LIST_MEMBER(rsa, $enabled_pubkey_ciphers)
1809 if test "$found" = "1" ; then
1810    GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS rsa.lo"
1811    AC_DEFINE(USE_RSA, 1, [Defined if this module should be included])
1812 fi
1813
1814 LIST_MEMBER(elgamal, $enabled_pubkey_ciphers)
1815 if test "$found" = "1" ; then
1816    GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS elgamal.lo"
1817    AC_DEFINE(USE_ELGAMAL, 1, [Defined if this module should be included])
1818 fi
1819
1820 LIST_MEMBER(ecc, $enabled_pubkey_ciphers)
1821 if test "$found" = "1" ; then
1822    GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS \
1823                           ecc.lo ecc-curves.lo ecc-misc.lo \
1824                           ecc-ecdsa.lo ecc-eddsa.lo ecc-gost.lo"
1825    AC_DEFINE(USE_ECC, 1, [Defined if this module should be included])
1826 fi
1827
1828 LIST_MEMBER(crc, $enabled_digests)
1829 if test "$found" = "1" ; then
1830    GCRYPT_DIGESTS="$GCRYPT_DIGESTS crc.lo"
1831    AC_DEFINE(USE_CRC, 1, [Defined if this module should be included])
1832 fi
1833
1834 LIST_MEMBER(gostr3411-94, $enabled_digests)
1835 if test "$found" = "1" ; then
1836    # GOST R 34.11-94 internally uses GOST 28147-89
1837    LIST_MEMBER(gost28147, $enabled_ciphers)
1838    if test "$found" = "1" ; then
1839       GCRYPT_DIGESTS="$GCRYPT_DIGESTS gostr3411-94.lo"
1840       AC_DEFINE(USE_GOST_R_3411_94, 1, [Defined if this module should be included])
1841    fi
1842 fi
1843
1844 LIST_MEMBER(stribog, $enabled_digests)
1845 if test "$found" = "1" ; then
1846    GCRYPT_DIGESTS="$GCRYPT_DIGESTS stribog.lo"
1847    AC_DEFINE(USE_GOST_R_3411_12, 1, [Defined if this module should be included])
1848 fi
1849
1850 LIST_MEMBER(md2, $enabled_digests)
1851 if test "$found" = "1" ; then
1852    GCRYPT_DIGESTS="$GCRYPT_DIGESTS md2.lo"
1853    AC_DEFINE(USE_MD2, 1, [Defined if this module should be included])
1854 fi
1855
1856 LIST_MEMBER(md4, $enabled_digests)
1857 if test "$found" = "1" ; then
1858    GCRYPT_DIGESTS="$GCRYPT_DIGESTS md4.lo"
1859    AC_DEFINE(USE_MD4, 1, [Defined if this module should be included])
1860 fi
1861
1862 LIST_MEMBER(md5, $enabled_digests)
1863 if test "$found" = "1" ; then
1864    GCRYPT_DIGESTS="$GCRYPT_DIGESTS md5.lo"
1865    AC_DEFINE(USE_MD5, 1, [Defined if this module should be included])
1866 fi
1867
1868 LIST_MEMBER(sha256, $enabled_digests)
1869 if test "$found" = "1" ; then
1870    GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256.lo"
1871    AC_DEFINE(USE_SHA256, 1, [Defined if this module should be included])
1872
1873    case "${host}" in
1874       x86_64-*-*)
1875          # Build with the assembly implementation
1876          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-ssse3-amd64.lo"
1877          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-avx-amd64.lo"
1878          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-avx2-bmi2-amd64.lo"
1879       ;;
1880    esac
1881 fi
1882
1883 LIST_MEMBER(sha512, $enabled_digests)
1884 if test "$found" = "1" ; then
1885    GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512.lo"
1886    AC_DEFINE(USE_SHA512, 1, [Defined if this module should be included])
1887
1888    case "${host}" in
1889       x86_64-*-*)
1890          # Build with the assembly implementation
1891          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-ssse3-amd64.lo"
1892          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-avx-amd64.lo"
1893          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-avx2-bmi2-amd64.lo"
1894       ;;
1895    esac
1896
1897    if test x"$neonsupport" = xyes ; then
1898      # Build with the NEON implementation
1899      GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-armv7-neon.lo"
1900    fi
1901 fi
1902
1903 LIST_MEMBER(tiger, $enabled_digests)
1904 if test "$found" = "1" ; then
1905    GCRYPT_DIGESTS="$GCRYPT_DIGESTS tiger.lo"
1906    AC_DEFINE(USE_TIGER, 1, [Defined if this module should be included])
1907 fi
1908
1909 LIST_MEMBER(whirlpool, $enabled_digests)
1910 if test "$found" = "1" ; then
1911    GCRYPT_DIGESTS="$GCRYPT_DIGESTS whirlpool.lo"
1912    AC_DEFINE(USE_WHIRLPOOL, 1, [Defined if this module should be included])
1913 fi
1914
1915 # rmd160 and sha1 should be included always.
1916 GCRYPT_DIGESTS="$GCRYPT_DIGESTS rmd160.lo sha1.lo"
1917 AC_DEFINE(USE_RMD160, 1, [Defined if this module should be included])
1918 AC_DEFINE(USE_SHA1, 1,   [Defined if this module should be included])
1919
1920 case "${host}" in
1921   x86_64-*-*)
1922     # Build with the assembly implementation
1923     GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-ssse3-amd64.lo"
1924     GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-avx-amd64.lo"
1925     GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-avx-bmi2-amd64.lo"
1926   ;;
1927   arm*-*-*)
1928     # Build with the assembly implementation
1929     GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-armv7-neon.lo"
1930   ;;
1931 esac
1932
1933 LIST_MEMBER(scrypt, $enabled_kdfs)
1934 if test "$found" = "1" ; then
1935    GCRYPT_KDFS="$GCRYPT_KDFS scrypt.lo"
1936    AC_DEFINE(USE_SCRYPT, 1, [Defined if this module should be included])
1937 fi
1938
1939 LIST_MEMBER(linux, $random_modules)
1940 if test "$found" = "1" ; then
1941    GCRYPT_RANDOM="$GCRYPT_RANDOM rndlinux.lo"
1942    AC_DEFINE(USE_RNDLINUX, 1, [Defined if the /dev/random RNG should be used.])
1943 fi
1944
1945 LIST_MEMBER(unix, $random_modules)
1946 if test "$found" = "1" ; then
1947    GCRYPT_RANDOM="$GCRYPT_RANDOM rndunix.lo"
1948    AC_DEFINE(USE_RNDUNIX, 1, [Defined if the default Unix RNG should be used.])
1949    print_egd_notice=yes
1950 fi
1951
1952 LIST_MEMBER(egd, $random_modules)
1953 if test "$found" = "1" ; then
1954    GCRYPT_RANDOM="$GCRYPT_RANDOM rndegd.lo"
1955    AC_DEFINE(USE_RNDEGD, 1, [Defined if the EGD based RNG should be used.])
1956 fi
1957
1958 LIST_MEMBER(w32, $random_modules)
1959 if test "$found" = "1" ; then
1960    GCRYPT_RANDOM="$GCRYPT_RANDOM rndw32.lo"
1961    AC_DEFINE(USE_RNDW32, 1,
1962              [Defined if the Windows specific RNG should be used.])
1963 fi
1964
1965 LIST_MEMBER(w32ce, $random_modules)
1966 if test "$found" = "1" ; then
1967    GCRYPT_RANDOM="$GCRYPT_RANDOM rndw32ce.lo"
1968    AC_DEFINE(USE_RNDW32CE, 1,
1969              [Defined if the WindowsCE specific RNG should be used.])
1970 fi
1971
1972 AC_SUBST([GCRYPT_CIPHERS])
1973 AC_SUBST([GCRYPT_PUBKEY_CIPHERS])
1974 AC_SUBST([GCRYPT_DIGESTS])
1975 AC_SUBST([GCRYPT_KDFS])
1976 AC_SUBST([GCRYPT_RANDOM])
1977
1978 AC_SUBST(LIBGCRYPT_CIPHERS, $enabled_ciphers)
1979 AC_SUBST(LIBGCRYPT_PUBKEY_CIPHERS, $enabled_pubkey_ciphers)
1980 AC_SUBST(LIBGCRYPT_DIGESTS, $enabled_digests)
1981
1982 # For printing the configuration we need a colon separated list of
1983 # algorithm names.
1984 tmp=`echo "$enabled_ciphers" | tr ' ' : `
1985 AC_DEFINE_UNQUOTED(LIBGCRYPT_CIPHERS, "$tmp",
1986                    [List of available cipher algorithms])
1987 tmp=`echo "$enabled_pubkey_ciphers" | tr ' ' : `
1988 AC_DEFINE_UNQUOTED(LIBGCRYPT_PUBKEY_CIPHERS, "$tmp",
1989                    [List of available public key cipher algorithms])
1990 tmp=`echo "$enabled_digests" | tr ' ' : `
1991 AC_DEFINE_UNQUOTED(LIBGCRYPT_DIGESTS, "$tmp",
1992                    [List of available digest algorithms])
1993 tmp=`echo "$enabled_kdfs" | tr ' ' : `
1994 AC_DEFINE_UNQUOTED(LIBGCRYPT_KDFS, "$tmp",
1995                    [List of available KDF algorithms])
1996
1997
1998 #
1999 # Define conditional sources depending on the used hardware platform.
2000 # Note that all possible modules must also be listed in
2001 # src/Makefile.am (EXTRA_libgcrypt_la_SOURCES).
2002 #
2003 GCRYPT_HWF_MODULES=
2004 case "$mpi_cpu_arch" in
2005      x86)
2006         AC_DEFINE(HAVE_CPU_ARCH_X86, 1,   [Defined for the x86 platforms])
2007         GCRYPT_HWF_MODULES="hwf-x86.lo"
2008         ;;
2009      alpha)
2010         AC_DEFINE(HAVE_CPU_ARCH_ALPHA, 1, [Defined for Alpha platforms])
2011         ;;
2012      sparc)
2013         AC_DEFINE(HAVE_CPU_ARCH_SPARC, 1, [Defined for SPARC platforms])
2014         ;;
2015      mips)
2016         AC_DEFINE(HAVE_CPU_ARCH_MIPS, 1,  [Defined for MIPS platforms])
2017         ;;
2018      m68k)
2019         AC_DEFINE(HAVE_CPU_ARCH_M68K, 1,  [Defined for M68k platforms])
2020         ;;
2021      ppc)
2022         AC_DEFINE(HAVE_CPU_ARCH_PPC, 1,   [Defined for PPC platforms])
2023         ;;
2024      arm)
2025         AC_DEFINE(HAVE_CPU_ARCH_ARM, 1,   [Defined for ARM platforms])
2026         GCRYPT_HWF_MODULES="hwf-arm.lo"
2027         ;;
2028 esac
2029 AC_SUBST([GCRYPT_HWF_MODULES])
2030
2031
2032 #
2033 # Provide information about the build.
2034 #
2035 BUILD_REVISION="mym4_revision"
2036 AC_SUBST(BUILD_REVISION)
2037 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
2038                    [GIT commit id revision used to build this package])
2039
2040 changequote(,)dnl
2041 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
2042 changequote([,])dnl
2043 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
2044 AC_SUBST(BUILD_FILEVERSION)
2045
2046 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
2047 AC_SUBST(BUILD_TIMESTAMP)
2048 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
2049                    [The time this package was configured for a build])
2050
2051
2052 # And create the files.
2053 AC_CONFIG_FILES([
2054 Makefile
2055 m4/Makefile
2056 compat/Makefile
2057 mpi/Makefile
2058 cipher/Makefile
2059 random/Makefile
2060 doc/Makefile
2061 src/Makefile
2062 src/gcrypt.h
2063 src/libgcrypt-config
2064 src/versioninfo.rc
2065 tests/Makefile
2066 ])
2067 AC_CONFIG_FILES([tests/hashtest-256g], [chmod +x tests/hashtest-256g])
2068 AC_OUTPUT
2069
2070
2071 detection_module="${GCRYPT_HWF_MODULES%.lo}"
2072 test -n "$detection_module" || detection_module="none"
2073
2074 # Give some feedback
2075 GCRY_MSG_SHOW([],[])
2076 GCRY_MSG_SHOW([Libgcrypt],[v${VERSION} has been configured as follows:])
2077 GCRY_MSG_SHOW([],[])
2078 GCRY_MSG_SHOW([Platform:                 ],[$PRINTABLE_OS_NAME ($host)])
2079 GCRY_MSG_SHOW([Hardware detection module:],[$detection_module])
2080 GCRY_MSG_WRAP([Enabled cipher algorithms:],[$enabled_ciphers])
2081 GCRY_MSG_WRAP([Enabled digest algorithms:],[$enabled_digests])
2082 GCRY_MSG_WRAP([Enabled kdf algorithms:   ],[$enabled_kdfs])
2083 GCRY_MSG_WRAP([Enabled pubkey algorithms:],[$enabled_pubkey_ciphers])
2084 GCRY_MSG_SHOW([Random number generator:  ],[$random])
2085 GCRY_MSG_SHOW([Using linux capabilities: ],[$use_capabilities])
2086 GCRY_MSG_SHOW([Try using Padlock crypto: ],[$padlocksupport])
2087 GCRY_MSG_SHOW([Try using AES-NI crypto:  ],[$aesnisupport])
2088 GCRY_MSG_SHOW([Try using Intel PCLMUL:   ],[$pclmulsupport])
2089 GCRY_MSG_SHOW([Try using DRNG (RDRAND):  ],[$drngsupport])
2090 GCRY_MSG_SHOW([Try using Intel AVX:      ],[$avxsupport])
2091 GCRY_MSG_SHOW([Try using Intel AVX2:     ],[$avx2support])
2092 GCRY_MSG_SHOW([Try using ARM NEON:       ],[$neonsupport])
2093 GCRY_MSG_SHOW([],[])
2094
2095 if test "$print_egd_notice" = "yes"; then
2096 cat <<G10EOF
2097
2098    The performance of the Unix random gatherer module (rndunix) is not
2099    very good and it does not keep the entropy pool over multiple
2100    invocations of Libgcrypt base applications.  The suggested way to
2101    overcome this problem is to use the
2102
2103                  Entropy Gathering Daemon (EGD)
2104
2105    which provides a entropy source for the whole system.  It is written
2106    in Perl and available at the GnuPG FTP servers.  To enable EGD you
2107    should rerun configure with the option "--enable-static-rnd=egd".
2108    For more information consult the GnuPG webpages:
2109
2110              http://www.gnupg.org/download.html#egd
2111
2112 G10EOF
2113 fi
2114
2115 if test "$gcry_cv_gcc_attribute_aligned" != "yes" ; then
2116 cat <<G10EOF
2117
2118    Please not that your compiler does not support the GCC style
2119    aligned attribute. Using this software may evoke bus errors.
2120
2121 G10EOF
2122 fi
2123
2124 if test -n "$gpl"; then
2125   echo "Please note that you are building a version of Libgcrypt with"
2126   echo "  $gpl"
2127   echo "included.  These parts are licensed under the GPL and thus the"
2128   echo "use of this library has to comply with the conditions of the GPL."
2129 fi