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