Small Windows build tweaks.
[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           AC_EGREP_CPP(yes,
1311           [#if defined(__arm__) && \
1312              ((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
1313              || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
1314              || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
1315              || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
1316              || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
1317              || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
1318              || defined(__ARM_ARCH_7EM__))
1319             yes
1320            #endif
1321           ], gcry_cv_cc_arm_arch_is_v6=yes, gcry_cv_cc_arm_arch_is_v6=no)
1322         fi])
1323 if test "$gcry_cv_cc_arm_arch_is_v6" = "yes" ; then
1324    AC_DEFINE(HAVE_ARM_ARCH_V6,1,
1325      [Defined if ARM architecture is v6 or newer])
1326 fi
1327
1328
1329 #
1330 # Check whether GCC inline assembler supports NEON instructions
1331 #
1332 AC_CACHE_CHECK([whether GCC inline assembler supports NEON instructions],
1333        [gcry_cv_gcc_inline_asm_neon],
1334        [if test "$mpi_cpu_arch" != "arm" ; then
1335           gcry_cv_gcc_inline_asm_neon="n/a"
1336         else
1337           gcry_cv_gcc_inline_asm_neon=no
1338           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1339           [[__asm__(
1340                 ".syntax unified\n\t"
1341                 ".thumb\n\t"
1342                 ".fpu neon\n\t"
1343                 "vld1.64 {%q0-%q1}, [%r0]!;\n\t"
1344                 "vrev64.8 %q0, %q3;\n\t"
1345                 "vadd.u64 %q0, %q1;\n\t"
1346                 "vadd.s64 %d3, %d2, %d3;\n\t"
1347                 );
1348             ]])],
1349           [gcry_cv_gcc_inline_asm_neon=yes])
1350         fi])
1351 if test "$gcry_cv_gcc_inline_asm_neon" = "yes" ; then
1352    AC_DEFINE(HAVE_GCC_INLINE_ASM_NEON,1,
1353      [Defined if inline assembler supports NEON instructions])
1354 fi
1355
1356
1357 #######################################
1358 #### Checks for library functions. ####
1359 #######################################
1360
1361 AC_FUNC_VPRINTF
1362 # We have replacements for these in src/missing-string.c
1363 AC_CHECK_FUNCS(stpcpy strcasecmp)
1364 # We have replacements for these in src/g10lib.h
1365 AC_CHECK_FUNCS(strtoul memmove stricmp atexit raise)
1366 # Other checks
1367 AC_CHECK_FUNCS(strerror rand mmap getpagesize sysconf waitpid wait4)
1368 AC_CHECK_FUNCS(gettimeofday getrusage gethrtime clock_gettime syslog)
1369 AC_CHECK_FUNCS(fcntl ftruncate flockfile)
1370
1371 GNUPG_CHECK_MLOCK
1372
1373 #
1374 # Replacement functions.
1375 #
1376 AC_REPLACE_FUNCS([getpid clock])
1377
1378
1379 #
1380 # Check wether it is necessary to link against libdl.
1381 #
1382 DL_LIBS=""
1383 if test "$use_hmac_binary_check" = yes ; then
1384   _gcry_save_libs="$LIBS"
1385   LIBS=""
1386   AC_SEARCH_LIBS(dlopen, c dl,,,)
1387   DL_LIBS=$LIBS
1388   LIBS="$_gcry_save_libs"
1389   LIBGCRYPT_CONFIG_LIBS="${LIBGCRYPT_CONFIG_LIBS} ${DL_LIBS}"
1390 fi
1391 AC_SUBST(DL_LIBS)
1392
1393
1394 #
1395 # Check whether we can use Linux capabilities as requested.
1396 #
1397 if test "$use_capabilities" = "yes" ; then
1398 use_capabilities=no
1399 AC_CHECK_HEADERS(sys/capability.h)
1400 if test "$ac_cv_header_sys_capability_h" = "yes" ; then
1401   AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1)
1402   if test "$ac_cv_lib_cap_cap_init" = "yes"; then
1403      AC_DEFINE(USE_CAPABILITIES,1,
1404                [define if capabilities should be used])
1405      LIBS="$LIBS -lcap"
1406      use_capabilities=yes
1407   fi
1408 fi
1409 if test "$use_capabilities" = "no" ; then
1410     AC_MSG_WARN([[
1411 ***
1412 *** The use of capabilities on this system is not possible.
1413 *** You need a recent Linux kernel and some patches:
1414 ***   fcaps-2.2.9-990610.patch      (kernel patch for 2.2.9)
1415 ***   fcap-module-990613.tar.gz     (kernel module)
1416 ***   libcap-1.92.tar.gz            (user mode library and utilities)
1417 *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN
1418 *** set (filesystems menu). Be warned: This code is *really* ALPHA.
1419 ***]])
1420 fi
1421 fi
1422
1423 # Check whether a random device is available.
1424 if test "$try_dev_random" = yes ; then
1425     AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1426     [if test -r "$NAME_OF_DEV_RANDOM" && test -r "$NAME_OF_DEV_URANDOM" ; then
1427       ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
1428     if test "$ac_cv_have_dev_random" = yes; then
1429         AC_DEFINE(HAVE_DEV_RANDOM,1,
1430                  [defined if the system supports a random device] )
1431     fi
1432 else
1433     AC_MSG_CHECKING(for random device)
1434     ac_cv_have_dev_random=no
1435     AC_MSG_RESULT(has been disabled)
1436 fi
1437
1438 # Figure out the random modules for this configuration.
1439 if test "$random" = "default"; then
1440
1441     # Select default value.
1442     if test "$ac_cv_have_dev_random" = yes; then
1443         # Try Linuxish random device.
1444         random_modules="linux"
1445     else
1446         case "${host}" in
1447         *-*-mingw32ce*)
1448           # WindowsCE random device.
1449           random_modules="w32ce"
1450           ;;
1451         *-*-mingw32*|*-*-cygwin*)
1452           # Windows random device.
1453           random_modules="w32"
1454           ;;
1455         *)
1456           # Build everything, allow to select at runtime.
1457           random_modules="$auto_random_modules"
1458           ;;
1459         esac
1460     fi
1461 else
1462     if test "$random" = "auto"; then
1463         # Build everything, allow to select at runtime.
1464         random_modules="$auto_random_modules"
1465     else
1466         random_modules="$random"
1467     fi
1468 fi
1469
1470
1471 #
1472 # Other defines
1473 #
1474 if test mym4_isgit = "yes"; then
1475     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1476               [Defined if this is not a regular release])
1477 fi
1478
1479
1480 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1481
1482
1483 # This is handy for debugging so the compiler doesn't rearrange
1484 # things and eliminate variables.
1485 AC_ARG_ENABLE(optimization,
1486        AC_HELP_STRING([--disable-optimization],
1487                       [disable compiler optimization]),
1488                       [if test $enableval = no ; then
1489                          CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
1490                        fi])
1491
1492 # CFLAGS mangling when using gcc.
1493 if test "$GCC" = yes; then
1494     CFLAGS="$CFLAGS -Wall"
1495     if test "$USE_MAINTAINER_MODE" = "yes"; then
1496         CFLAGS="$CFLAGS -Wcast-align -Wshadow -Wstrict-prototypes"
1497         CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1498
1499         # If -Wno-missing-field-initializers is supported we can enable a
1500         # a bunch of really useful warnings.
1501         AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1502         _gcc_cflags_save=$CFLAGS
1503         CFLAGS="-Wno-missing-field-initializers"
1504         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1505         AC_MSG_RESULT($_gcc_wopt)
1506         CFLAGS=$_gcc_cflags_save;
1507         if test x"$_gcc_wopt" = xyes ; then
1508           CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast"
1509           CFLAGS="$CFLAGS -Wwrite-strings"
1510           CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1511           CFLAGS="$CFLAGS -Wno-missing-field-initializers"
1512           CFLAGS="$CFLAGS -Wno-sign-compare"
1513         fi
1514
1515         AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1516         _gcc_cflags_save=$CFLAGS
1517         CFLAGS="-Wpointer-arith"
1518         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1519         AC_MSG_RESULT($_gcc_wopt)
1520         CFLAGS=$_gcc_cflags_save;
1521         if test x"$_gcc_wopt" = xyes ; then
1522           CFLAGS="$CFLAGS -Wpointer-arith"
1523         fi
1524     fi
1525
1526 fi
1527
1528 # Check whether as(1) supports a noeexecstack feature.  This test
1529 # includes an override option.
1530 CL_AS_NOEXECSTACK
1531
1532
1533 AC_SUBST(LIBGCRYPT_CONFIG_API_VERSION)
1534 AC_SUBST(LIBGCRYPT_CONFIG_LIBS)
1535 AC_SUBST(LIBGCRYPT_CONFIG_CFLAGS)
1536 AC_SUBST(LIBGCRYPT_CONFIG_HOST)
1537 AC_SUBST(LIBGCRYPT_THREAD_MODULES)
1538
1539 AC_CONFIG_COMMANDS([gcrypt-conf],[[
1540 chmod +x src/libgcrypt-config
1541 ]],[[
1542 prefix=$prefix
1543 exec_prefix=$exec_prefix
1544 libdir=$libdir
1545 datadir=$datadir
1546 DATADIRNAME=$DATADIRNAME
1547 ]])
1548
1549 #####################
1550 #### Conclusion. ####
1551 #####################
1552
1553 # Check that requested feature can actually be used and define
1554 # ENABLE_foo_SUPPORT macros.
1555
1556 if test x"$aesnisupport" = xyes ; then
1557   if test "$gcry_cv_gcc_inline_asm_ssse3" != "yes" ; then
1558     aesnisupport="no (unsupported by compiler)"
1559   fi
1560 fi
1561 if test x"$pclmulsupport" = xyes ; then
1562   if test "$gcry_cv_gcc_inline_asm_pclmul" != "yes" ; then
1563     pclmulsupport="no (unsupported by compiler)"
1564   fi
1565 fi
1566 if test x"$avxsupport" = xyes ; then
1567   if test "$gcry_cv_gcc_inline_asm_avx" != "yes" ; then
1568     avxsupport="no (unsupported by compiler)"
1569   fi
1570 fi
1571 if test x"$avx2support" = xyes ; then
1572   if test "$gcry_cv_gcc_inline_asm_avx2" != "yes" ; then
1573     avx2support="no (unsupported by compiler)"
1574   fi
1575 fi
1576 if test x"$neonsupport" = xyes ; then
1577   if test "$gcry_cv_gcc_inline_asm_neon" != "yes" ; then
1578     neonsupport="no (unsupported by compiler)"
1579   fi
1580 fi
1581
1582 if test x"$aesnisupport" = xyes ; then
1583   AC_DEFINE(ENABLE_AESNI_SUPPORT, 1,
1584             [Enable support for Intel AES-NI instructions.])
1585 fi
1586 if test x"$pclmulsupport" = xyes ; then
1587   AC_DEFINE(ENABLE_PCLMUL_SUPPORT, 1,
1588             [Enable support for Intel PCLMUL instructions.])
1589 fi
1590 if test x"$avxsupport" = xyes ; then
1591   AC_DEFINE(ENABLE_AVX_SUPPORT,1,
1592             [Enable support for Intel AVX instructions.])
1593 fi
1594 if test x"$avx2support" = xyes ; then
1595   AC_DEFINE(ENABLE_AVX2_SUPPORT,1,
1596             [Enable support for Intel AVX2 instructions.])
1597 fi
1598 if test x"$neonsupport" = xyes ; then
1599   AC_DEFINE(ENABLE_NEON_SUPPORT,1,
1600             [Enable support for ARM NEON instructions.])
1601 fi
1602 if test x"$padlocksupport" = xyes ; then
1603   AC_DEFINE(ENABLE_PADLOCK_SUPPORT, 1,
1604             [Enable support for the PadLock engine.])
1605 fi
1606 if test x"$drngsupport" = xyes ; then
1607   AC_DEFINE(ENABLE_DRNG_SUPPORT, 1,
1608             [Enable support for Intel DRNG (RDRAND instruction).])
1609 fi
1610
1611
1612 # Define conditional sources and config.h symbols depending on the
1613 # selected ciphers, pubkey-ciphers, digests, kdfs, and random modules.
1614
1615 LIST_MEMBER(arcfour, $enabled_ciphers)
1616 if test "$found" = "1"; then
1617    GCRYPT_CIPHERS="$GCRYPT_CIPHERS arcfour.lo"
1618    AC_DEFINE(USE_ARCFOUR, 1, [Defined if this module should be included])
1619
1620    case "${host}" in
1621       x86_64-*-*)
1622          # Build with the assembly implementation
1623          GCRYPT_CIPHERS="$GCRYPT_CIPHERS arcfour-amd64.lo"
1624       ;;
1625    esac
1626 fi
1627
1628 LIST_MEMBER(blowfish, $enabled_ciphers)
1629 if test "$found" = "1" ; then
1630    GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish.lo"
1631    AC_DEFINE(USE_BLOWFISH, 1, [Defined if this module should be included])
1632
1633    case "${host}" in
1634       x86_64-*-*)
1635          # Build with the assembly implementation
1636          GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish-amd64.lo"
1637       ;;
1638       arm*-*-*)
1639          # Build with the assembly implementation
1640          GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish-arm.lo"
1641       ;;
1642    esac
1643 fi
1644
1645 LIST_MEMBER(cast5, $enabled_ciphers)
1646 if test "$found" = "1" ; then
1647    GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5.lo"
1648    AC_DEFINE(USE_CAST5, 1, [Defined if this module should be included])
1649
1650    case "${host}" in
1651       x86_64-*-*)
1652          # Build with the assembly implementation
1653          GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5-amd64.lo"
1654       ;;
1655       arm*-*-*)
1656          # Build with the assembly implementation
1657          GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5-arm.lo"
1658       ;;
1659    esac
1660 fi
1661
1662 LIST_MEMBER(des, $enabled_ciphers)
1663 if test "$found" = "1" ; then
1664    GCRYPT_CIPHERS="$GCRYPT_CIPHERS des.lo"
1665    AC_DEFINE(USE_DES, 1, [Defined if this module should be included])
1666 fi
1667
1668 LIST_MEMBER(aes, $enabled_ciphers)
1669 if test "$found" = "1" ; then
1670    GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael.lo"
1671    AC_DEFINE(USE_AES, 1, [Defined if this module should be included])
1672
1673    case "${host}" in
1674       x86_64-*-*)
1675          # Build with the assembly implementation
1676          GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-amd64.lo"
1677       ;;
1678       arm*-*-*)
1679          # Build with the assembly implementation
1680          GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael-arm.lo"
1681       ;;
1682    esac
1683 fi
1684
1685 LIST_MEMBER(twofish, $enabled_ciphers)
1686 if test "$found" = "1" ; then
1687    GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish.lo"
1688    AC_DEFINE(USE_TWOFISH, 1, [Defined if this module should be included])
1689
1690    case "${host}" in
1691       x86_64-*-*)
1692          # Build with the assembly implementation
1693          GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish-amd64.lo"
1694       ;;
1695       arm*-*-*)
1696          # Build with the assembly implementation
1697          GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish-arm.lo"
1698       ;;
1699    esac
1700 fi
1701
1702 LIST_MEMBER(serpent, $enabled_ciphers)
1703 if test "$found" = "1" ; then
1704    GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent.lo"
1705    AC_DEFINE(USE_SERPENT, 1, [Defined if this module should be included])
1706
1707    case "${host}" in
1708       x86_64-*-*)
1709          # Build with the SSE2 implementation
1710          GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent-sse2-amd64.lo"
1711       ;;
1712    esac
1713
1714    if test x"$avx2support" = xyes ; then
1715       # Build with the AVX2 implementation
1716       GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent-avx2-amd64.lo"
1717    fi
1718
1719    if test x"$neonsupport" = xyes ; then
1720       # Build with the NEON implementation
1721       GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent-armv7-neon.lo"
1722    fi
1723 fi
1724
1725 LIST_MEMBER(rfc2268, $enabled_ciphers)
1726 if test "$found" = "1" ; then
1727    GCRYPT_CIPHERS="$GCRYPT_CIPHERS rfc2268.lo"
1728    AC_DEFINE(USE_RFC2268, 1, [Defined if this module should be included])
1729 fi
1730
1731 LIST_MEMBER(seed, $enabled_ciphers)
1732 if test "$found" = "1" ; then
1733    GCRYPT_CIPHERS="$GCRYPT_CIPHERS seed.lo"
1734    AC_DEFINE(USE_SEED, 1, [Defined if this module should be included])
1735 fi
1736
1737 LIST_MEMBER(camellia, $enabled_ciphers)
1738 if test "$found" = "1" ; then
1739    GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia.lo camellia-glue.lo"
1740    AC_DEFINE(USE_CAMELLIA, 1, [Defined if this module should be included])
1741
1742    case "${host}" in
1743       arm*-*-*)
1744          # Build with the assembly implementation
1745          GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-arm.lo"
1746       ;;
1747    esac
1748
1749    if test x"$avxsupport" = xyes ; then
1750       if test x"$aesnisupport" = xyes ; then
1751         # Build with the AES-NI/AVX implementation
1752         GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-aesni-avx-amd64.lo"
1753       fi
1754    fi
1755
1756    if test x"$avx2support" = xyes ; then
1757       if test x"$aesnisupport" = xyes ; then
1758         # Build with the AES-NI/AVX2 implementation
1759         GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia-aesni-avx2-amd64.lo"
1760       fi
1761    fi
1762 fi
1763
1764 LIST_MEMBER(idea, $enabled_ciphers)
1765 if test "$found" = "1" ; then
1766    GCRYPT_CIPHERS="$GCRYPT_CIPHERS idea.lo"
1767    AC_DEFINE(USE_IDEA, 1, [Defined if this module should be included])
1768 fi
1769
1770 LIST_MEMBER(salsa20, $enabled_ciphers)
1771 if test "$found" = "1" ; then
1772    GCRYPT_CIPHERS="$GCRYPT_CIPHERS salsa20.lo"
1773    AC_DEFINE(USE_SALSA20, 1, [Defined if this module should be included])
1774
1775    case "${host}" in
1776       x86_64-*-*)
1777          # Build with the assembly implementation
1778          GCRYPT_CIPHERS="$GCRYPT_CIPHERS salsa20-amd64.lo"
1779       ;;
1780    esac
1781
1782    if test x"$neonsupport" = xyes ; then
1783      # Build with the NEON implementation
1784      GCRYPT_CIPHERS="$GCRYPT_CIPHERS salsa20-armv7-neon.lo"
1785    fi
1786 fi
1787
1788 LIST_MEMBER(gost28147, $enabled_ciphers)
1789 if test "$found" = "1" ; then
1790    GCRYPT_CIPHERS="$GCRYPT_CIPHERS gost28147.lo"
1791    AC_DEFINE(USE_GOST28147, 1, [Defined if this module should be included])
1792 fi
1793
1794 LIST_MEMBER(dsa, $enabled_pubkey_ciphers)
1795 if test "$found" = "1" ; then
1796    GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS dsa.lo"
1797    AC_DEFINE(USE_DSA, 1, [Defined if this module should be included])
1798 fi
1799
1800 LIST_MEMBER(rsa, $enabled_pubkey_ciphers)
1801 if test "$found" = "1" ; then
1802    GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS rsa.lo"
1803    AC_DEFINE(USE_RSA, 1, [Defined if this module should be included])
1804 fi
1805
1806 LIST_MEMBER(elgamal, $enabled_pubkey_ciphers)
1807 if test "$found" = "1" ; then
1808    GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS elgamal.lo"
1809    AC_DEFINE(USE_ELGAMAL, 1, [Defined if this module should be included])
1810 fi
1811
1812 LIST_MEMBER(ecc, $enabled_pubkey_ciphers)
1813 if test "$found" = "1" ; then
1814    GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS \
1815                           ecc.lo ecc-curves.lo ecc-misc.lo \
1816                           ecc-ecdsa.lo ecc-eddsa.lo ecc-gost.lo"
1817    AC_DEFINE(USE_ECC, 1, [Defined if this module should be included])
1818 fi
1819
1820 LIST_MEMBER(crc, $enabled_digests)
1821 if test "$found" = "1" ; then
1822    GCRYPT_DIGESTS="$GCRYPT_DIGESTS crc.lo"
1823    AC_DEFINE(USE_CRC, 1, [Defined if this module should be included])
1824 fi
1825
1826 LIST_MEMBER(gostr3411-94, $enabled_digests)
1827 if test "$found" = "1" ; then
1828    # GOST R 34.11-94 internally uses GOST 28147-89
1829    LIST_MEMBER(gost28147, $enabled_ciphers)
1830    if test "$found" = "1" ; then
1831       GCRYPT_DIGESTS="$GCRYPT_DIGESTS gostr3411-94.lo"
1832       AC_DEFINE(USE_GOST_R_3411_94, 1, [Defined if this module should be included])
1833    fi
1834 fi
1835
1836 LIST_MEMBER(stribog, $enabled_digests)
1837 if test "$found" = "1" ; then
1838    GCRYPT_DIGESTS="$GCRYPT_DIGESTS stribog.lo"
1839    AC_DEFINE(USE_GOST_R_3411_12, 1, [Defined if this module should be included])
1840 fi
1841
1842 LIST_MEMBER(md4, $enabled_digests)
1843 if test "$found" = "1" ; then
1844    GCRYPT_DIGESTS="$GCRYPT_DIGESTS md4.lo"
1845    AC_DEFINE(USE_MD4, 1, [Defined if this module should be included])
1846 fi
1847
1848 LIST_MEMBER(md5, $enabled_digests)
1849 if test "$found" = "1" ; then
1850    GCRYPT_DIGESTS="$GCRYPT_DIGESTS md5.lo"
1851    AC_DEFINE(USE_MD5, 1, [Defined if this module should be included])
1852 fi
1853
1854 LIST_MEMBER(sha256, $enabled_digests)
1855 if test "$found" = "1" ; then
1856    GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256.lo"
1857    AC_DEFINE(USE_SHA256, 1, [Defined if this module should be included])
1858
1859    case "${host}" in
1860       x86_64-*-*)
1861          # Build with the assembly implementation
1862          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-ssse3-amd64.lo"
1863          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-avx-amd64.lo"
1864          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256-avx2-bmi2-amd64.lo"
1865       ;;
1866    esac
1867 fi
1868
1869 LIST_MEMBER(sha512, $enabled_digests)
1870 if test "$found" = "1" ; then
1871    GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512.lo"
1872    AC_DEFINE(USE_SHA512, 1, [Defined if this module should be included])
1873
1874    case "${host}" in
1875       x86_64-*-*)
1876          # Build with the assembly implementation
1877          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-ssse3-amd64.lo"
1878          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-avx-amd64.lo"
1879          GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-avx2-bmi2-amd64.lo"
1880       ;;
1881    esac
1882
1883    if test x"$neonsupport" = xyes ; then
1884      # Build with the NEON implementation
1885      GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512-armv7-neon.lo"
1886    fi
1887 fi
1888
1889 LIST_MEMBER(tiger, $enabled_digests)
1890 if test "$found" = "1" ; then
1891    GCRYPT_DIGESTS="$GCRYPT_DIGESTS tiger.lo"
1892    AC_DEFINE(USE_TIGER, 1, [Defined if this module should be included])
1893 fi
1894
1895 LIST_MEMBER(whirlpool, $enabled_digests)
1896 if test "$found" = "1" ; then
1897    GCRYPT_DIGESTS="$GCRYPT_DIGESTS whirlpool.lo"
1898    AC_DEFINE(USE_WHIRLPOOL, 1, [Defined if this module should be included])
1899 fi
1900
1901 # rmd160 and sha1 should be included always.
1902 GCRYPT_DIGESTS="$GCRYPT_DIGESTS rmd160.lo sha1.lo"
1903 AC_DEFINE(USE_RMD160, 1, [Defined if this module should be included])
1904 AC_DEFINE(USE_SHA1, 1,   [Defined if this module should be included])
1905
1906 case "${host}" in
1907   x86_64-*-*)
1908     # Build with the assembly implementation
1909     GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-ssse3-amd64.lo"
1910     GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-avx-amd64.lo"
1911     GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-avx-bmi2-amd64.lo"
1912   ;;
1913   arm*-*-*)
1914     # Build with the assembly implementation
1915     GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha1-armv7-neon.lo"
1916   ;;
1917 esac
1918
1919 LIST_MEMBER(scrypt, $enabled_kdfs)
1920 if test "$found" = "1" ; then
1921    GCRYPT_KDFS="$GCRYPT_KDFS scrypt.lo"
1922    AC_DEFINE(USE_SCRYPT, 1, [Defined if this module should be included])
1923 fi
1924
1925 LIST_MEMBER(linux, $random_modules)
1926 if test "$found" = "1" ; then
1927    GCRYPT_RANDOM="$GCRYPT_RANDOM rndlinux.lo"
1928    AC_DEFINE(USE_RNDLINUX, 1, [Defined if the /dev/random RNG should be used.])
1929 fi
1930
1931 LIST_MEMBER(unix, $random_modules)
1932 if test "$found" = "1" ; then
1933    GCRYPT_RANDOM="$GCRYPT_RANDOM rndunix.lo"
1934    AC_DEFINE(USE_RNDUNIX, 1, [Defined if the default Unix RNG should be used.])
1935    print_egd_notice=yes
1936 fi
1937
1938 LIST_MEMBER(egd, $random_modules)
1939 if test "$found" = "1" ; then
1940    GCRYPT_RANDOM="$GCRYPT_RANDOM rndegd.lo"
1941    AC_DEFINE(USE_RNDEGD, 1, [Defined if the EGD based RNG should be used.])
1942 fi
1943
1944 LIST_MEMBER(w32, $random_modules)
1945 if test "$found" = "1" ; then
1946    GCRYPT_RANDOM="$GCRYPT_RANDOM rndw32.lo"
1947    AC_DEFINE(USE_RNDW32, 1,
1948              [Defined if the Windows specific RNG should be used.])
1949 fi
1950
1951 LIST_MEMBER(w32ce, $random_modules)
1952 if test "$found" = "1" ; then
1953    GCRYPT_RANDOM="$GCRYPT_RANDOM rndw32ce.lo"
1954    AC_DEFINE(USE_RNDW32CE, 1,
1955              [Defined if the WindowsCE specific RNG should be used.])
1956 fi
1957
1958 AC_SUBST([GCRYPT_CIPHERS])
1959 AC_SUBST([GCRYPT_PUBKEY_CIPHERS])
1960 AC_SUBST([GCRYPT_DIGESTS])
1961 AC_SUBST([GCRYPT_KDFS])
1962 AC_SUBST([GCRYPT_RANDOM])
1963
1964 AC_SUBST(LIBGCRYPT_CIPHERS, $enabled_ciphers)
1965 AC_SUBST(LIBGCRYPT_PUBKEY_CIPHERS, $enabled_pubkey_ciphers)
1966 AC_SUBST(LIBGCRYPT_DIGESTS, $enabled_digests)
1967
1968 # For printing the configuration we need a colon separated list of
1969 # algorithm names.
1970 tmp=`echo "$enabled_ciphers" | tr ' ' : `
1971 AC_DEFINE_UNQUOTED(LIBGCRYPT_CIPHERS, "$tmp",
1972                    [List of available cipher algorithms])
1973 tmp=`echo "$enabled_pubkey_ciphers" | tr ' ' : `
1974 AC_DEFINE_UNQUOTED(LIBGCRYPT_PUBKEY_CIPHERS, "$tmp",
1975                    [List of available public key cipher algorithms])
1976 tmp=`echo "$enabled_digests" | tr ' ' : `
1977 AC_DEFINE_UNQUOTED(LIBGCRYPT_DIGESTS, "$tmp",
1978                    [List of available digest algorithms])
1979 tmp=`echo "$enabled_kdfs" | tr ' ' : `
1980 AC_DEFINE_UNQUOTED(LIBGCRYPT_KDFS, "$tmp",
1981                    [List of available KDF algorithms])
1982
1983
1984 #
1985 # Define conditional sources depending on the used hardware platform.
1986 # Note that all possible modules must also be listed in
1987 # src/Makefile.am (EXTRA_libgcrypt_la_SOURCES).
1988 #
1989 GCRYPT_HWF_MODULES=
1990 case "$mpi_cpu_arch" in
1991      x86)
1992         AC_DEFINE(HAVE_CPU_ARCH_X86, 1,   [Defined for the x86 platforms])
1993         GCRYPT_HWF_MODULES="hwf-x86.lo"
1994         ;;
1995      alpha)
1996         AC_DEFINE(HAVE_CPU_ARCH_ALPHA, 1, [Defined for Alpha platforms])
1997         ;;
1998      sparc)
1999         AC_DEFINE(HAVE_CPU_ARCH_SPARC, 1, [Defined for SPARC platforms])
2000         ;;
2001      mips)
2002         AC_DEFINE(HAVE_CPU_ARCH_MIPS, 1,  [Defined for MIPS platforms])
2003         ;;
2004      m68k)
2005         AC_DEFINE(HAVE_CPU_ARCH_M68K, 1,  [Defined for M68k platforms])
2006         ;;
2007      ppc)
2008         AC_DEFINE(HAVE_CPU_ARCH_PPC, 1,   [Defined for PPC platforms])
2009         ;;
2010      arm)
2011         AC_DEFINE(HAVE_CPU_ARCH_ARM, 1,   [Defined for ARM platforms])
2012         GCRYPT_HWF_MODULES="hwf-arm.lo"
2013         ;;
2014 esac
2015 AC_SUBST([GCRYPT_HWF_MODULES])
2016
2017
2018 #
2019 # Provide information about the build.
2020 #
2021 BUILD_REVISION="mym4_revision"
2022 AC_SUBST(BUILD_REVISION)
2023 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
2024                    [GIT commit id revision used to build this package])
2025
2026 changequote(,)dnl
2027 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
2028 changequote([,])dnl
2029 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
2030 AC_SUBST(BUILD_FILEVERSION)
2031
2032 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
2033 AC_SUBST(BUILD_TIMESTAMP)
2034 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
2035                    [The time this package was configured for a build])
2036
2037
2038 # And create the files.
2039 AC_CONFIG_FILES([
2040 Makefile
2041 m4/Makefile
2042 compat/Makefile
2043 mpi/Makefile
2044 cipher/Makefile
2045 random/Makefile
2046 doc/Makefile
2047 src/Makefile
2048 src/gcrypt.h
2049 src/libgcrypt-config
2050 src/versioninfo.rc
2051 tests/Makefile
2052 ])
2053 AC_CONFIG_FILES([tests/hashtest-256g], [chmod +x tests/hashtest-256g])
2054 AC_OUTPUT
2055
2056
2057 detection_module="${GCRYPT_HWF_MODULES%.lo}"
2058 test -n "$detection_module" || detection_module="none"
2059
2060 # Give some feedback
2061 GCRY_MSG_SHOW([],[])
2062 GCRY_MSG_SHOW([Libgcrypt],[v${VERSION} has been configured as follows:])
2063 GCRY_MSG_SHOW([],[])
2064 GCRY_MSG_SHOW([Platform:                 ],[$PRINTABLE_OS_NAME ($host)])
2065 GCRY_MSG_SHOW([Hardware detection module:],[$detection_module])
2066 GCRY_MSG_WRAP([Enabled cipher algorithms:],[$enabled_ciphers])
2067 GCRY_MSG_WRAP([Enabled digest algorithms:],[$enabled_digests])
2068 GCRY_MSG_WRAP([Enabled kdf algorithms:   ],[$enabled_kdfs])
2069 GCRY_MSG_WRAP([Enabled pubkey algorithms:],[$enabled_pubkey_ciphers])
2070 GCRY_MSG_SHOW([Random number generator:  ],[$random])
2071 GCRY_MSG_SHOW([Using linux capabilities: ],[$use_capabilities])
2072 GCRY_MSG_SHOW([Try using Padlock crypto: ],[$padlocksupport])
2073 GCRY_MSG_SHOW([Try using AES-NI crypto:  ],[$aesnisupport])
2074 GCRY_MSG_SHOW([Try using Intel PCLMUL:   ],[$pclmulsupport])
2075 GCRY_MSG_SHOW([Try using DRNG (RDRAND):  ],[$drngsupport])
2076 GCRY_MSG_SHOW([Try using Intel AVX:      ],[$avxsupport])
2077 GCRY_MSG_SHOW([Try using Intel AVX2:     ],[$avx2support])
2078 GCRY_MSG_SHOW([Try using ARM NEON:       ],[$neonsupport])
2079 GCRY_MSG_SHOW([],[])
2080
2081 if test "$print_egd_notice" = "yes"; then
2082 cat <<G10EOF
2083
2084    The performance of the Unix random gatherer module (rndunix) is not
2085    very good and it does not keep the entropy pool over multiple
2086    invocations of Libgcrypt base applications.  The suggested way to
2087    overcome this problem is to use the
2088
2089                  Entropy Gathering Daemon (EGD)
2090
2091    which provides a entropy source for the whole system.  It is written
2092    in Perl and available at the GnuPG FTP servers.  To enable EGD you
2093    should rerun configure with the option "--enable-static-rnd=egd".
2094    For more information consult the GnuPG webpages:
2095
2096              http://www.gnupg.org/download.html#egd
2097
2098 G10EOF
2099 fi
2100
2101 if test "$gcry_cv_gcc_attribute_aligned" != "yes" ; then
2102 cat <<G10EOF
2103
2104    Please not that your compiler does not support the GCC style
2105    aligned attribute. Using this software may evoke bus errors.
2106
2107 G10EOF
2108 fi
2109
2110 if test -n "$gpl"; then
2111   echo "Please note that you are building a version of Libgcrypt with"
2112   echo "  $gpl"
2113   echo "included.  These parts are licensed under the GPL and thus the"
2114   echo "use of this library has to comply with the conditions of the GPL."
2115 fi