michael@0: dnl Process this file with autoconf to produce a configure script. michael@0: AC_INIT(srtp) michael@0: michael@0: dnl Must come before AC_PROG_CC michael@0: if test -z "$CFLAGS"; then michael@0: dnl Default value for CFLAGS if not specified. michael@0: CFLAGS="-Wall -O4 -fexpensive-optimizations -funroll-loops" michael@0: fi michael@0: michael@0: dnl Checks for programs. michael@0: AC_PROG_RANLIB michael@0: AC_PROG_CC michael@0: AC_PROG_INSTALL michael@0: michael@0: dnl Check the byte order michael@0: AC_C_BIGENDIAN michael@0: michael@0: AC_CANONICAL_HOST michael@0: michael@0: dnl check host_cpu type, set defines appropriately michael@0: case $host_cpu in michael@0: i*86 | x86_64 ) michael@0: AC_DEFINE(CPU_CISC, 1, michael@0: [Define if building for a CISC machine (e.g. Intel).]) michael@0: AC_DEFINE(HAVE_X86, 1, michael@0: [Define to use X86 inlined assembly code]);; michael@0: * ) michael@0: # CPU_RISC is only supported for big endian machines. michael@0: if test "$ac_cv_c_bigendian" = "yes"; then michael@0: AC_DEFINE(CPU_RISC, 1, michael@0: [Define if building for a RISC machine (assume slow byte access).]) michael@0: else michael@0: AC_DEFINE(CPU_CISC, 1) michael@0: fi michael@0: ;; michael@0: esac michael@0: michael@0: dnl Check if we are on a Windows platform. michael@0: case $host_os in michael@0: *cygwin*|*mingw* ) michael@0: EXE=.exe michael@0: HOST_IS_WINDOWS=yes michael@0: ;; michael@0: * ) michael@0: EXE="" michael@0: ;; michael@0: esac michael@0: AC_SUBST(EXE) # define executable suffix; this is needed for `make clean' michael@0: michael@0: michael@0: AC_ARG_ENABLE(kernel-linux, michael@0: [AS_HELP_STRING([--enable-kernel-linux], michael@0: [build library to run in Linux kernel context])], michael@0: [], enable_kernel_linux=no) michael@0: AC_MSG_CHECKING(whether to build for Linux kernel context) michael@0: if test "$enable_kernel_linux" = "yes"; then michael@0: AC_DEFINE(SRTP_KERNEL, 1, michael@0: [Define to compile for kernel contexts.]) michael@0: AC_DEFINE(SRTP_KERNEL_LINUX, 1, michael@0: [Define to compile for Linux kernel context.]) michael@0: fi michael@0: AC_MSG_RESULT($enable_kernel_linux) michael@0: michael@0: if test "$cross_compiling" != yes -a "$HOST_IS_WINDOWS" != yes; then michael@0: dnl Check for /dev/urandom michael@0: AC_CHECK_FILE(/dev/urandom, DEV_URANDOM=/dev/urandom, michael@0: [AC_CHECK_FILE(/dev/random, DEV_URANDOM=/dev/random)]) michael@0: fi michael@0: michael@0: AC_MSG_CHECKING(which random device to use) michael@0: if test "$enable_kernel_linux" = "yes"; then michael@0: RNG_OBJS=rand_linux_kernel.o michael@0: AC_MSG_RESULT([Linux kernel builtin]) michael@0: else michael@0: RNG_OBJS=rand_source.o michael@0: if test -n "$DEV_URANDOM"; then michael@0: AC_DEFINE_UNQUOTED(DEV_URANDOM, "$DEV_URANDOM",[Path to random device]) michael@0: AC_MSG_RESULT([$DEV_URANDOM]) michael@0: else michael@0: AC_MSG_RESULT([standard rand() function...]) michael@0: fi michael@0: fi michael@0: AC_SUBST(RNG_OBJS) michael@0: michael@0: michael@0: dnl Checks for header files. michael@0: AC_HEADER_STDC michael@0: AC_CHECK_HEADERS(stdlib.h) michael@0: AC_CHECK_HEADERS(unistd.h) michael@0: AC_CHECK_HEADERS(byteswap.h) michael@0: AC_CHECK_HEADERS(stdint.h) michael@0: AC_CHECK_HEADERS(sys/uio.h) michael@0: AC_CHECK_HEADERS(inttypes.h) michael@0: AC_CHECK_HEADERS(sys/types.h) michael@0: AC_CHECK_HEADERS(machine/types.h) michael@0: AC_CHECK_HEADERS(sys/int_types.h) michael@0: michael@0: dnl socket() and friends michael@0: AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h) michael@0: AC_CHECK_HEADERS(windows.h, [AC_CHECK_HEADERS(winsock2.h)]) michael@0: michael@0: AC_CHECK_HEADERS(syslog.h) michael@0: michael@0: AC_CHECK_TYPES([int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,uint64_t]) michael@0: AC_CHECK_SIZEOF(unsigned long) michael@0: AC_CHECK_SIZEOF(unsigned long long) michael@0: michael@0: dnl Checks for typedefs, structures, and compiler characteristics. michael@0: AC_C_CONST michael@0: AC_C_INLINE michael@0: AC_TYPE_SIZE_T michael@0: michael@0: dnl Checks for library functions. michael@0: AC_CHECK_FUNCS(socket inet_aton usleep sigaction) michael@0: michael@0: dnl Find socket function if not found yet. michael@0: if test "x$ac_cv_func_socket" = "xno"; then michael@0: AC_CHECK_LIB(socket, socket) michael@0: AC_MSG_CHECKING([for socket in -lwsock32]) michael@0: SAVELIBS="$LIBS" michael@0: LIBS="$LIBS -lwsock32" michael@0: AC_TRY_LINK([ michael@0: #include michael@0: ],[ michael@0: socket(0, 0, 0); michael@0: ], michael@0: ac_cv_func_socket=yes michael@0: AC_MSG_RESULT(yes), michael@0: LIBS="$SAVELIBS" michael@0: AC_MSG_RESULT(no)) michael@0: fi michael@0: michael@0: AC_MSG_CHECKING(whether to compile in debugging) michael@0: AC_ARG_ENABLE(debug, michael@0: [AS_HELP_STRING([--disable-debug], michael@0: [do not compile in dynamic debugging system])], michael@0: [], enable_debug=yes) michael@0: if test "$enable_debug" = "yes"; then michael@0: AC_DEFINE(ENABLE_DEBUGGING, 1, michael@0: [Define to compile in dynamic debugging system.]) michael@0: fi michael@0: AC_MSG_RESULT($enable_debug) michael@0: michael@0: AC_MSG_CHECKING(whether to use ISMAcryp code) michael@0: AC_ARG_ENABLE(generic-aesicm, michael@0: [AS_HELP_STRING([--enable-generic-aesicm], michael@0: [compile in changes for ISMAcryp])], michael@0: [], enable_generic_aesicm=no) michael@0: if test "$enable_generic_aesicm" = "yes"; then michael@0: AC_DEFINE(GENERIC_AESICM, 1, [Define this to use ISMAcryp code.]) michael@0: fi michael@0: AC_MSG_RESULT($enable_generic_aesicm) michael@0: michael@0: AC_MSG_CHECKING(whether to use syslog for error reporting) michael@0: AC_ARG_ENABLE(syslog, michael@0: [AS_HELP_STRING([--enable-syslog], [use syslog for error reporting])], michael@0: [], enable_syslog=no) michael@0: if test "$enable_syslog" = "yes"; then michael@0: AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog logging.]) michael@0: fi michael@0: AC_MSG_RESULT($enable_syslog) michael@0: michael@0: AC_MSG_CHECKING(whether to use stdout for error reporting) michael@0: AC_ARG_ENABLE(stdout, michael@0: [AS_HELP_STRING([--disable-stdout], [don't use stdout for error reporting])], michael@0: [], enable_stdout=yes) michael@0: if test "$enable_stdout" = "yes"; then michael@0: AC_DEFINE(ERR_REPORTING_STDOUT, 1, [Define to use logging to stdout.]) michael@0: fi michael@0: AC_MSG_RESULT($enable_stdout) michael@0: michael@0: AC_MSG_CHECKING(whether to use /dev/console for error reporting) michael@0: AC_ARG_ENABLE(console, michael@0: [AS_HELP_STRING([--enable-console], [use /dev/console for error reporting])], michael@0: [], enable_console=no) michael@0: if test "$enable_console" = "yes"; then michael@0: AC_DEFINE(USE_ERR_REPORTING_FILE, 1, [Write errors to this file]) michael@0: AC_DEFINE(ERR_REPORTING_FILE, "/dev/console", [Report errors to this file.]) michael@0: fi michael@0: AC_MSG_RESULT($enable_console) michael@0: michael@0: AC_MSG_CHECKING(whether to use GDOI key management) michael@0: AC_ARG_ENABLE(gdoi, michael@0: [AS_HELP_STRING([--enable-gdoi], [enable GDOI key management])], michael@0: [], enable_gdoi=no) michael@0: if test "$enable_gdoi" = "yes"; then michael@0: AC_DEFINE(SRTP_GDOI, 1, [Define to use GDOI.]) michael@0: GDOI_OBJS=gdoi/srtp+gdoi.o michael@0: AC_SUBST(GDOI_OBJS) michael@0: fi michael@0: AC_MSG_RESULT($enable_gdoi) michael@0: michael@0: AC_CONFIG_HEADER(crypto/include/config.h:config_in.h) michael@0: michael@0: AC_OUTPUT(Makefile crypto/Makefile doc/Makefile) michael@0: michael@0: # This is needed when building outside the source dir. michael@0: AS_MKDIR_P(crypto/ae_xfm) michael@0: AS_MKDIR_P(crypto/cipher) michael@0: AS_MKDIR_P(crypto/hash) michael@0: AS_MKDIR_P(crypto/kernel) michael@0: AS_MKDIR_P(crypto/math) michael@0: AS_MKDIR_P(crypto/replay) michael@0: AS_MKDIR_P(crypto/rng) michael@0: AS_MKDIR_P(crypto/test) michael@0: AS_MKDIR_P(doc) michael@0: AS_MKDIR_P(srtp) michael@0: AS_MKDIR_P(tables) michael@0: AS_MKDIR_P(test)