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