Merged silc_1_1_branch to trunk.
[silc.git] / lib / silccrypt / configure.ad
1 #ifdef SILC_DIST_CRYPTO
2 #
3 #  lib/silccrypt/configure.ad
4 #
5 #  Author: Pekka Riikonen <priikone@silcnet.org>
6 #
7 #  Copyright (C) 2006 - 2007 Pekka Riikonen
8 #
9 #  This program is free software; you can redistribute it and/or modify
10 #  it under the terms of the GNU General Public License as published by
11 #  the Free Software Foundation; version 2 of the License.
12 #
13 #  This program 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 General Public License for more details.
17 #
18
19 if test x$compile_libs = xtrue; then
20
21 AC_MSG_NOTICE([configuring crypto library])
22 SILC_CRYPTO_CFLAGS=
23
24 aes_asm=false
25
26 if test "${pic_mode:-default}" != "yes" ; then
27 case "$host_cpu" in
28   i?86)
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     ;;
35   x86_64)
36     if test x$have_assembler = xtrue -a "$enable_shared" != "yes"; then
37       aes_asm=true
38       AC_DEFINE([SILC_AES_ASM], [], [SILC_AES_ASM])
39     fi
40     ;;
41   default)
42     aes_asm=false
43     ;;
44 esac
45 fi
46
47 SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fno-regmove)
48 if test x$summary_debug = xno -a x$want_cc_optimizations = xtrue; then
49   SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fomit-frame-pointer -O3)
50 fi
51
52 AC_SUBST(SILC_CRYPTO_CFLAGS)
53
54 AC_CONFIG_FILES(
55 lib/silccrypt/Makefile
56 #ifdef SILC_DIST_INPLACE
57 lib/silccrypt/tests/Makefile
58 #endif SILC_DIST_INPLACE
59 )
60
61 fi      # compile_libs
62
63 # AM_CONDITIONAL is so bad that it itself cannot be defined in conditional
64 AM_CONDITIONAL(SILC_AES_ASM, test x$aes_asm = xtrue)
65
66 #endif SILC_DIST_CRYPTO