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