~ubuntu-branches/ubuntu/saucy/nettle/saucy-proposed

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Marek Habersack
  • Date: 2004-05-04 15:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20040504155602-7jbhw5mabvwksl3j
Tags: upstream-1.10
ImportĀ upstreamĀ versionĀ 1.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl -*- mode: shell-script; sh-indentation: 2; -*-
 
2
 
 
3
dnl Process this file with autoconf to produce a configure script.
 
4
 
 
5
AC_INIT([nettle], [1.10])
 
6
AC_CONFIG_SRCDIR([arcfour.c])
 
7
AC_PREREQ(2.50)
 
8
AM_INIT_AUTOMAKE
 
9
AM_CONFIG_HEADER([config.h])
 
10
 
 
11
SHLIBMAJOR=2
 
12
SHLIBMINOR=2
 
13
 
 
14
AC_CANONICAL_HOST
 
15
 
 
16
# Command line options
 
17
AC_ARG_WITH(include-path,
 
18
  AC_HELP_STRING([--with-include-path], [A colon-separated list of directories to search for include files]),,
 
19
  [with_include_path=''])
 
20
 
 
21
if test x$with_include_path != x ; then
 
22
  CPPFLAGS="$CPPFLAGS -I`echo $with_include_path | sed 's/:/ -I/g'`"
 
23
fi
 
24
 
 
25
AC_ARG_WITH(lib-path,
 
26
  AC_HELP_STRING([--with-lib-path], [A colon-separated list of directories to search for libraries]),,
 
27
  [with_lib_path=''])
 
28
 
 
29
if test x$with_lib_path != x ; then
 
30
  LDFLAGS="$LDFLAGS -L`echo $with_lib_path | sed 's/:/ -L/g'`"
 
31
fi
 
32
 
 
33
AC_ARG_ENABLE(public-key,
 
34
  AC_HELP_STRING([--disable-public-key], [Disable public key algorithms]),,
 
35
  [enable_public_key=yes])
 
36
 
 
37
AC_ARG_ENABLE(assembler,
 
38
  AC_HELP_STRING([--disable-assembler],[Disable assembler code]),,
 
39
  [enable_assembler=yes])
 
40
 
 
41
AC_ARG_ENABLE(shared,
 
42
  AC_HELP_STRING([--enable-shared], [Build a shared library]),,
 
43
  [enable_shared=no])
 
44
 
 
45
LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \
 
46
    `echo $exec_prefix | sed "s@^NONE@$prefix/lib@g" | sed "s@^NONE@$ac_default_prefix/lib@g"` \
 
47
    /usr/local/lib /sw/local/lib /sw/lib \
 
48
    /usr/gnu/lib /opt/gnu/lib /sw/gnu/lib /usr/freeware/lib /usr/pkg/lib])
 
49
 
 
50
# Checks for programs.
 
51
AC_PROG_CC
 
52
 
 
53
# When $CC foo.c -o foo creates both foo and foo.exe, autoconf picks
 
54
# up the foo.exe and sets exeext to .exe. That is correct for cygwin,
 
55
# which has some kind of magic link from foo to foo.exe, but not for
 
56
# rntcl. A better check for the cygwin case would check if the
 
57
# contents of foo and foo.exe are equal; in the rntcl case, foo is a
 
58
# sh script, and foo.exe is a windows executable.
 
59
 
 
60
if test "x$CC" = xrntcl ; then
 
61
    AC_MSG_NOTICE([Compiling with rntcl; clearing EXEEXT])
 
62
    ac_exeext=''
 
63
    ac_cv_exeext=''
 
64
    EXEEXT=''
 
65
fi
 
66
 
 
67
AC_PROG_MAKE_SET
 
68
AC_PROG_RANLIB
 
69
AM_PROG_CC_STDC
 
70
 
 
71
if test "x$am_cv_prog_cc_stdc" = xno ; then
 
72
  AC_ERROR([the C compiler doesn't handle ANSI-C])
 
73
fi
 
74
 
 
75
# Select assembler code
 
76
asm_path=
 
77
case "$host" in
 
78
  [i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*])
 
79
    asm_path=x86
 
80
    ;;
 
81
  *sparc*-*-*)
 
82
    asm_path=sparc
 
83
    ;;
 
84
  *)
 
85
    enable_assembler=no
 
86
    ;;
 
87
esac
 
88
 
 
89
# echo "enable_assembler: $enable_assembler, asm_path: $asm_path"
 
90
 
 
91
if test "x$enable_assembler" = xyes ; then
 
92
  if test -n "$asm_path"; then
 
93
    AC_MSG_NOTICE([Looking for assembler files in $asm_path/.])
 
94
    found=no
 
95
    for tmp_f in aes.asm aes-encrypt.asm aes-decrypt.asm \
 
96
                 arcfour-crypt.asm sha1-compress.asm machine.m4; do
 
97
#       echo "Looking for $srcdir/$asm_path/$tmp_f"
 
98
      if test -f "$srcdir/$asm_path/$tmp_f"; then
 
99
#        echo found
 
100
        found=yes
 
101
        AC_CONFIG_LINKS($tmp_f:$asm_path/$tmp_f)
 
102
      fi
 
103
    done
 
104
    if test "$found" = no; then
 
105
      enable_assembler=no
 
106
      AC_MSG_WARN([No assembler files found.])
 
107
    fi
 
108
  fi
 
109
fi
 
110
 
 
111
SHLIBCFLAGS="-fpic"
 
112
SHLIBFORLINK=libnettle.so
 
113
SHLIBSONAME='$(SHLIBFORLINK).$(SHLIBMAJOR)'
 
114
SHLIBFILE='$(SHLIBSONAME).$(SHLIBMINOR)'
 
115
SHLIBLINK='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME)'
 
116
 
 
117
echo "enable_shared: $enable_shared"
 
118
     
 
119
if test "x$enable_shared" = xyes ; then
 
120
  SHLIBTARGET='$(SHLIBFORLINK)'
 
121
  SHLIBINSTALL=install-shared
 
122
else
 
123
  SHLIBTARGET=''
 
124
  SHLIBINSTALL=''
 
125
fi
 
126
 
 
127
AM_CONDITIONAL([ENABLE_ASSEMBLER], [test x$enable_assembler = xyes])
 
128
AM_CONDITIONAL([ENABLE_SHARED],  [test x$enable_shared = xyes])
 
129
 
 
130
AC_SUBST(SHLIBCFLAGS)
 
131
AC_SUBST(SHLIBMAJOR)
 
132
AC_SUBST(SHLIBMINOR)
 
133
AC_SUBST(SHLIBFORLINK)
 
134
AC_SUBST(SHLIBSONAME)
 
135
AC_SUBST(SHLIBFILE)
 
136
AC_SUBST(SHLIBLINK)
 
137
AC_SUBST(SHLIBTARGET)
 
138
AC_SUBST(SHLIBINSTALL)
 
139
        
 
140
AC_PATH_PROG(M4, m4, m4)
 
141
 
 
142
# Checks for typedefs, structures, and compiler characteristics.
 
143
AC_C_CONST
 
144
AC_C_INLINE
 
145
AC_TYPE_UID_T
 
146
AC_TYPE_SIZE_T
 
147
AC_HEADER_TIME
 
148
 
 
149
LSH_FUNC_ALLOCA
 
150
 
 
151
# Needed by the supplied memcmp.c
 
152
AC_C_BIGENDIAN
 
153
AC_REPLACE_FUNCS(memxor)
 
154
 
 
155
LSH_GCC_ATTRIBUTES
 
156
 
 
157
# According to Simon Josefsson, looking for uint32_t and friends in
 
158
# sys/types.h is needed on some systems, in particular cygwin.
 
159
AX_CREATE_STDINT_H([nettle-types.h], [sys/types.h])
 
160
 
 
161
# Checks for libraries
 
162
AC_CHECK_LIB(gmp, __gmpz_getlimbn,,
 
163
    [AC_MSG_WARN(
 
164
[GNU MP not found, or not 3.1 or up, see http://www.swox.com/gmp.
 
165
Support for public key algorithms will be unavailable.])]
 
166
    enable_public_key=no)
 
167
 
 
168
if test "x$enable_public_key" = xyes ; then
 
169
  AC_DEFINE(WITH_PUBLIC_KEY)
 
170
  RSA_EXAMPLES='rsa-keygen$(EXEEXT) rsa-sign$(EXEEXT) rsa-verify$(EXEEXT) rsa-encrypt$(EXEEXT) rsa-decrypt$(EXEEXT)'
 
171
else
 
172
  RSA_EXAMPLES=""
 
173
fi
 
174
 
 
175
AH_TEMPLATE([WITH_PUBLIC_KEY], [Define to enable public key features])
 
176
AC_SUBST(RSA_EXAMPLES)
 
177
 
 
178
# Add -R flags needed to run programs linked with gmp
 
179
LSH_RPATH_FIX
 
180
 
 
181
AH_TEMPLATE([HAVE_LIBCRYPTO],
 
182
            [Define if you have openssl's libcrypto (used for benchmarking)])
 
183
 
 
184
OPENSSL_LIBFLAGS=''
 
185
 
 
186
# Check for openssl's libcrypto (used only for benchmarking)
 
187
AC_CHECK_LIB(crypto, BF_ecb_encrypt,
 
188
  [AC_DEFINE(HAVE_LIBCRYPTO)
 
189
   OPENSSL_LIBFLAGS='-lcrypto'
 
190
])
 
191
 
 
192
AC_SUBST(OPENSSL_LIBFLAGS)
 
193
 
 
194
# Set these flags *last*, or else the test programs won't compile
 
195
if test x$GCC = xyes ; then
 
196
  # Using -ggdb3 makes (some versions of) Redhat's gcc-2.96 dump core
 
197
  if "$CC" --version | grep '^2\.96$' 1>/dev/null 2>&1; then
 
198
    true
 
199
  else
 
200
    CFLAGS="$CFLAGS -ggdb3"
 
201
  fi
 
202
  CFLAGS="$CFLAGS -Wall -W \
 
203
  -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
 
204
  -Wpointer-arith -Wbad-function-cast -Wnested-externs"
 
205
 
 
206
# Don't enable -Wcast-align as it results in tons of warnings in the
 
207
# DES code. And when using stdio.
 
208
# Don't enable -Waggregate-return, as that causes warnings for glibc
 
209
# inttypes.h.
 
210
fi
 
211
 
 
212
AC_OUTPUT(Makefile tools/Makefile testsuite/Makefile examples/Makefile config.m4)
 
213