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