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