Enabled AES assembler support on x86-64 in shared libraries.
[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 SILC_AES_ASM_FLAGS=
23
24 case "$host_cpu" in
25   i?86)
26     AC_DEFINE([SILC_SHA256_X86], [], [SILC_SHA256_X86])
27
28     if test "${pic_mode:-default}" != "yes" ; then
29       # Don't enable ASM AES with shared libs as the code doesn't support PIC.
30       if test x$have_assembler = xtrue -a "$enable_shared" != "yes"; then
31         aes_asm=true
32         AC_DEFINE([SILC_AES_ASM], [], [SILC_AES_ASM])
33       fi
34     fi
35     ;;
36   x86_64)
37
38     if test "${pic_mode:-default}" != "yes" ; then
39       if test x$have_assembler = xtrue; then
40         aes_asm=true
41         SILC_AES_ASM_FLAGS=-prefer-non-pic
42         AC_DEFINE([SILC_AES_ASM], [], [SILC_AES_ASM])
43       fi
44     fi
45     ;;
46   default)
47     aes_asm=false
48     ;;
49 esac
50
51 SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fno-regmove)
52 if test x$summary_debug = xno -a x$want_cc_optimizations = xtrue; then
53   SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fomit-frame-pointer -O3)
54 fi
55
56 AC_SUBST(SILC_CRYPTO_CFLAGS)
57 AC_SUBST(SILC_AES_ASM_FLAGS)
58
59 # AM_CONDITIONAL is so bad that it itself cannot be defined in conditional
60 AM_CONDITIONAL(SILC_AES_ASM, test x$aes_asm = xtrue)