1 dnl Process this file with autoconf to produce a configure script. 2 AC_INIT(srtp) 3 4 dnl Must come before AC_PROG_CC 5 if test -z "$CFLAGS"; then 6 dnl Default value for CFLAGS if not specified. 7 CFLAGS="-Wall -O4 -fexpensive-optimizations -funroll-loops" 8 fi 9 10 dnl Checks for programs. 11 AC_PROG_RANLIB 12 AC_PROG_CC 13 AC_PROG_INSTALL 14 15 dnl Check the byte order 16 AC_C_BIGENDIAN 17 18 AC_CANONICAL_HOST 19 20 dnl check host_cpu type, set defines appropriately 21 case $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 ;; 36 esac 37 38 dnl Check if we are on a Windows platform. 39 case $host_os in 40 *cygwin*|*mingw* ) 41 EXE=.exe 42 HOST_IS_WINDOWS=yes 43 ;; 44 * ) 45 EXE="" 46 ;; 47 esac 48 AC_SUBST(EXE) # define executable suffix; this is needed for `make clean' 49 50 51 AC_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) 55 AC_MSG_CHECKING(whether to build for Linux kernel context) 56 if 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.]) 61 fi 62 AC_MSG_RESULT($enable_kernel_linux) 63 64 if 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)]) 68 fi 69 70 AC_MSG_CHECKING(which random device to use) 71 if test "$enable_kernel_linux" = "yes"; then 72 RNG_OBJS=rand_linux_kernel.o 73 AC_MSG_RESULT([Linux kernel builtin]) 74 else 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 82 fi 83 AC_SUBST(RNG_OBJS) 84 85 86 dnl Checks for header files. 87 AC_HEADER_STDC 88 AC_CHECK_HEADERS(stdlib.h) 89 AC_CHECK_HEADERS(unistd.h) 90 AC_CHECK_HEADERS(byteswap.h) 91 AC_CHECK_HEADERS(stdint.h) 92 AC_CHECK_HEADERS(sys/uio.h) 93 AC_CHECK_HEADERS(inttypes.h) 94 AC_CHECK_HEADERS(sys/types.h) 95 AC_CHECK_HEADERS(machine/types.h) 96 AC_CHECK_HEADERS(sys/int_types.h) 97 98 dnl socket() and friends 99 AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h) 100 AC_CHECK_HEADERS(windows.h, [AC_CHECK_HEADERS(winsock2.h)]) 101 102 AC_CHECK_HEADERS(syslog.h) 103 104 AC_CHECK_TYPES([int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,uint64_t]) 105 AC_CHECK_SIZEOF(unsigned long) 106 AC_CHECK_SIZEOF(unsigned long long) 107 108 dnl Checks for typedefs, structures, and compiler characteristics. 109 AC_C_CONST 110 AC_C_INLINE 111 AC_TYPE_SIZE_T 112 113 dnl Checks for library functions. 114 AC_CHECK_FUNCS(socket inet_aton usleep) 115 116 dnl Find socket function if not found yet. 117 if 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 ],[ 125 socket(0, 0, 0); 126 ], 127 ac_cv_func_socket=yes 128 AC_MSG_RESULT(yes), 129 LIBS="$SAVELIBS" 130 AC_MSG_RESULT(no)) 131 fi 132 133 AC_MSG_CHECKING(whether to compile in debugging) 134 AC_ARG_ENABLE(debug, 135 [AS_HELP_STRING([--disable-debug], 136 [do not compile in dynamic debugging system])], 137 [], enable_debug=yes) 138 if test "$enable_debug" = "yes"; then 139 AC_DEFINE(ENABLE_DEBUGGING, 1, 140 [Define to compile in dynamic debugging system.]) 141 fi 142 AC_MSG_RESULT($enable_debug) 143 144 AC_MSG_CHECKING(whether to use ISMAcryp code) 145 AC_ARG_ENABLE(generic-aesicm, 146 [AS_HELP_STRING([--enable-generic-aesicm], 147 [compile in changes for ISMAcryp])], 148 [], enable_generic_aesicm=no) 149 if test "$enable_generic_aesicm" = "yes"; then 150 AC_DEFINE(GENERIC_AESICM, 1, [Define this to use ISMAcryp code.]) 151 fi 152 AC_MSG_RESULT($enable_generic_aesicm) 153 154 AC_MSG_CHECKING(whether to use syslog for error reporting) 155 AC_ARG_ENABLE(syslog, 156 [AS_HELP_STRING([--enable-syslog], [use syslog for error reporting])], 157 [], enable_syslog=no) 158 if test "$enable_syslog" = "yes"; then 159 AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog logging.]) 160 fi 161 AC_MSG_RESULT($enable_syslog) 162 163 AC_MSG_CHECKING(whether to use stdout for error reporting) 164 AC_ARG_ENABLE(stdout, 165 [AS_HELP_STRING([--disable-stdout], [don't use stdout for error reporting])], 166 [], enable_stdout=yes) 167 if test "$enable_stdout" = "yes"; then 168 AC_DEFINE(ERR_REPORTING_STDOUT, 1, [Define to use logging to stdout.]) 169 fi 170 AC_MSG_RESULT($enable_stdout) 171 172 AC_MSG_CHECKING(whether to use /dev/console for error reporting) 173 AC_ARG_ENABLE(console, 174 [AS_HELP_STRING([--enable-console], [use /dev/console for error reporting])], 175 [], enable_console=no) 176 if 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.]) 179 fi 180 AC_MSG_RESULT($enable_console) 181 182 AC_MSG_CHECKING(whether to use GDOI key management) 183 AC_ARG_ENABLE(gdoi, 184 [AS_HELP_STRING([--enable-gdoi], [enable GDOI key management])], 185 [], enable_gdoi=no) 186 if 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) 190 fi 191 AC_MSG_RESULT($enable_gdoi) 192 193 AC_CONFIG_HEADER(crypto/include/config.h:config_in.h) 194 195 AC_OUTPUT(Makefile crypto/Makefile doc/Makefile) 196 197 # This is needed when building outside the source dir. 198 AS_MKDIR_P(crypto/ae_xfm) 199 AS_MKDIR_P(crypto/cipher) 200 AS_MKDIR_P(crypto/hash) 201 AS_MKDIR_P(crypto/kernel) 202 AS_MKDIR_P(crypto/math) 203 AS_MKDIR_P(crypto/replay) 204 AS_MKDIR_P(crypto/rng) 205 AS_MKDIR_P(crypto/test) 206 AS_MKDIR_P(doc) 207 AS_MKDIR_P(srtp) 208 AS_MKDIR_P(tables) 209 AS_MKDIR_P(test) 210