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