blob: d6ad247c14ab13bcf3803fca878ce4a167a44857 [file] [log] [blame]
Param Reddappagari386ce4d2011-10-04 12:15:40 -07001dnl Process this file with autoconf to produce a configure script.
2AC_INIT(srtp)
3
4dnl Must come before AC_PROG_CC
5if test -z "$CFLAGS"; then
6 dnl Default value for CFLAGS if not specified.
7 CFLAGS="-Wall -O4 -fexpensive-optimizations -funroll-loops"
8fi
9
10dnl Checks for programs.
11AC_PROG_RANLIB
12AC_PROG_CC
13AC_PROG_INSTALL
14
15dnl Check the byte order
16AC_C_BIGENDIAN
17
18AC_CANONICAL_HOST
19
20dnl check host_cpu type, set defines appropriately
21case $host_cpu in
22 i*86 )
23 AC_DEFINE(CPU_CISC, 1,
24 [Define if building for a CISC machine (e.g. Intel).])
25 AC_DEFINE(HAVE_X86, 1,
26 [Define to use X86 inlined assembly code]);;
27 * )
28 # CPU_RISC is only supported for big endian machines.
29 if test "$ac_cv_c_bigendian" = "yes"; then
30 AC_DEFINE(CPU_RISC, 1,
31 [Define if building for a RISC machine (assume slow byte access).])
32 else
33 AC_DEFINE(CPU_CISC, 1)
34 fi
35 ;;
36esac
37
38dnl Check if we are on a Windows platform.
39case $host_os in
40 *cygwin*|*mingw* )
41 EXE=.exe
42 HOST_IS_WINDOWS=yes
43 ;;
44 * )
45 EXE=""
46 ;;
47esac
48AC_SUBST(EXE) # define executable suffix; this is needed for `make clean'
49
50
51AC_ARG_ENABLE(kernel-linux,
52 [AS_HELP_STRING([--enable-kernel-linux],
53 [build library to run in Linux kernel context])],
54 [], enable_kernel_linux=no)
55AC_MSG_CHECKING(whether to build for Linux kernel context)
56if test "$enable_kernel_linux" = "yes"; then
57 AC_DEFINE(SRTP_KERNEL, 1,
58 [Define to compile for kernel contexts.])
59 AC_DEFINE(SRTP_KERNEL_LINUX, 1,
60 [Define to compile for Linux kernel context.])
61fi
62AC_MSG_RESULT($enable_kernel_linux)
63
64if test "$cross_compiling" != yes -a "$HOST_IS_WINDOWS" != yes; then
65 dnl Check for /dev/urandom
66 AC_CHECK_FILE(/dev/urandom, DEV_URANDOM=/dev/urandom,
67 [AC_CHECK_FILE(/dev/random, DEV_URANDOM=/dev/random)])
68fi
69
70AC_MSG_CHECKING(which random device to use)
71if test "$enable_kernel_linux" = "yes"; then
72 RNG_OBJS=rand_linux_kernel.o
73 AC_MSG_RESULT([Linux kernel builtin])
74else
75 RNG_OBJS=rand_source.o
76 if test -n "$DEV_URANDOM"; then
77 AC_DEFINE_UNQUOTED(DEV_URANDOM, "$DEV_URANDOM",[Path to random device])
78 AC_MSG_RESULT([$DEV_URANDOM])
79 else
80 AC_MSG_RESULT([standard rand() function...])
81 fi
82fi
83AC_SUBST(RNG_OBJS)
84
85
86dnl Checks for header files.
87AC_HEADER_STDC
88AC_CHECK_HEADERS(stdlib.h)
89AC_CHECK_HEADERS(unistd.h)
90AC_CHECK_HEADERS(byteswap.h)
91AC_CHECK_HEADERS(stdint.h)
92AC_CHECK_HEADERS(sys/uio.h)
93AC_CHECK_HEADERS(inttypes.h)
94AC_CHECK_HEADERS(sys/types.h)
95AC_CHECK_HEADERS(machine/types.h)
96AC_CHECK_HEADERS(sys/int_types.h)
97
98dnl socket() and friends
99AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h)
100AC_CHECK_HEADERS(windows.h, [AC_CHECK_HEADERS(winsock2.h)])
101
102AC_CHECK_HEADERS(syslog.h)
103
104AC_CHECK_TYPES([int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,uint64_t])
105AC_CHECK_SIZEOF(unsigned long)
106AC_CHECK_SIZEOF(unsigned long long)
107
108dnl Checks for typedefs, structures, and compiler characteristics.
109AC_C_CONST
110AC_C_INLINE
111AC_TYPE_SIZE_T
112
113dnl Checks for library functions.
114AC_CHECK_FUNCS(socket inet_aton usleep)
115
116dnl Find socket function if not found yet.
117if test "x$ac_cv_func_socket" = "xno"; then
118 AC_CHECK_LIB(socket, socket)
119 AC_MSG_CHECKING([for socket in -lwsock32])
120 SAVELIBS="$LIBS"
121 LIBS="$LIBS -lwsock32"
122 AC_TRY_LINK([
123#include <winsock2.h>
124],[
125socket(0, 0, 0);
126],
127 ac_cv_func_socket=yes
128 AC_MSG_RESULT(yes),
129 LIBS="$SAVELIBS"
130 AC_MSG_RESULT(no))
131fi
132
133AC_MSG_CHECKING(whether to compile in debugging)
134AC_ARG_ENABLE(debug,
135 [AS_HELP_STRING([--disable-debug],
136 [do not compile in dynamic debugging system])],
137 [], enable_debug=yes)
138if test "$enable_debug" = "yes"; then
139 AC_DEFINE(ENABLE_DEBUGGING, 1,
140 [Define to compile in dynamic debugging system.])
141fi
142AC_MSG_RESULT($enable_debug)
143
144AC_MSG_CHECKING(whether to use ISMAcryp code)
145AC_ARG_ENABLE(generic-aesicm,
146 [AS_HELP_STRING([--enable-generic-aesicm],
147 [compile in changes for ISMAcryp])],
148 [], enable_generic_aesicm=no)
149if test "$enable_generic_aesicm" = "yes"; then
150 AC_DEFINE(GENERIC_AESICM, 1, [Define this to use ISMAcryp code.])
151fi
152AC_MSG_RESULT($enable_generic_aesicm)
153
154AC_MSG_CHECKING(whether to use syslog for error reporting)
155AC_ARG_ENABLE(syslog,
156 [AS_HELP_STRING([--enable-syslog], [use syslog for error reporting])],
157 [], enable_syslog=no)
158if test "$enable_syslog" = "yes"; then
159 AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog logging.])
160fi
161AC_MSG_RESULT($enable_syslog)
162
163AC_MSG_CHECKING(whether to use stdout for error reporting)
164AC_ARG_ENABLE(stdout,
165 [AS_HELP_STRING([--disable-stdout], [don't use stdout for error reporting])],
166 [], enable_stdout=yes)
167if test "$enable_stdout" = "yes"; then
168 AC_DEFINE(ERR_REPORTING_STDOUT, 1, [Define to use logging to stdout.])
169fi
170AC_MSG_RESULT($enable_stdout)
171
172AC_MSG_CHECKING(whether to use /dev/console for error reporting)
173AC_ARG_ENABLE(console,
174 [AS_HELP_STRING([--enable-console], [use /dev/console for error reporting])],
175 [], enable_console=no)
176if test "$enable_console" = "yes"; then
177 AC_DEFINE(USE_ERR_REPORTING_FILE, 1, [Write errors to this file])
178 AC_DEFINE(ERR_REPORTING_FILE, "/dev/console", [Report errors to this file.])
179fi
180AC_MSG_RESULT($enable_console)
181
182AC_MSG_CHECKING(whether to use GDOI key management)
183AC_ARG_ENABLE(gdoi,
184 [AS_HELP_STRING([--enable-gdoi], [enable GDOI key management])],
185 [], enable_gdoi=no)
186if test "$enable_gdoi" = "yes"; then
187 AC_DEFINE(SRTP_GDOI, 1, [Define to use GDOI.])
188 GDOI_OBJS=gdoi/srtp+gdoi.o
189 AC_SUBST(GDOI_OBJS)
190fi
191AC_MSG_RESULT($enable_gdoi)
192
193AC_CONFIG_HEADER(crypto/include/config.h:config_in.h)
194
195AC_OUTPUT(Makefile crypto/Makefile doc/Makefile)
196
197# This is needed when building outside the source dir.
198AS_MKDIR_P(crypto/ae_xfm)
199AS_MKDIR_P(crypto/cipher)
200AS_MKDIR_P(crypto/hash)
201AS_MKDIR_P(crypto/kernel)
202AS_MKDIR_P(crypto/math)
203AS_MKDIR_P(crypto/replay)
204AS_MKDIR_P(crypto/rng)
205AS_MKDIR_P(crypto/test)
206AS_MKDIR_P(doc)
207AS_MKDIR_P(srtp)
208AS_MKDIR_P(tables)
209AS_MKDIR_P(test)