Created SILC Crypto Toolkit git repository.
[crypto.git] / lib / silccrypt / configure.ad
1 #
2 #  lib/silccrypt/configure.ad
3 #
4 #  Author: Pekka Riikonen <priikone@silcnet.org>
5 #
6 #  Copyright (C) 2006 - 2008 Pekka Riikonen
7 #
8 #  This program is free software; you can redistribute it and/or modify
9 #  it under the terms of the GNU General Public License as published by
10 #  the Free Software Foundation; version 2 of the License.
11 #
12 #  This program is distributed in the hope that it will be useful,
13 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #  GNU General Public License for more details.
16 #
17
18 AC_MSG_NOTICE([configuring crypto library])
19 SILC_CRYPTO_CFLAGS=
20
21 aes_asm=false
22
23 case "$host_cpu" in
24   i?86)
25     AC_DEFINE([SILC_SHA256_X86], [], [SILC_SHA256_X86])
26
27     if test "${pic_mode:-default}" != "yes" ; then
28       # Don't enable ASM AES with shared libs as the code doesn't support PIC.
29       if test x$have_assembler = xtrue -a "$enable_shared" != "yes"; then
30         aes_asm=true
31         AC_DEFINE([SILC_AES_ASM], [], [SILC_AES_ASM])
32       fi
33     fi
34     ;;
35   x86_64)
36
37     if test "${pic_mode:-default}" != "yes" ; then
38       if test x$have_assembler = xtrue -a "$enable_shared" != "yes"; then
39         aes_asm=true
40         AC_DEFINE([SILC_AES_ASM], [], [SILC_AES_ASM])
41       fi
42     fi
43     ;;
44   default)
45     aes_asm=false
46     ;;
47 esac
48
49 SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fno-regmove)
50 if test x$summary_debug = xno -a x$want_cc_optimizations = xtrue; then
51   SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fomit-frame-pointer -O3)
52 fi
53
54 AC_SUBST(SILC_CRYPTO_CFLAGS)
55
56 # AM_CONDITIONAL is so bad that it itself cannot be defined in conditional
57 AM_CONDITIONAL(SILC_AES_ASM, test x$aes_asm = xtrue)