2014-07-04 11:18:53 +00:00
|
|
|
AC_PREREQ([2.63])
|
2016-01-09 19:16:04 +00:00
|
|
|
AC_INIT([cryb.to], [devel], [des@des.no], [cryb-to], [http://cryb.to/])
|
2016-09-04 12:56:39 +00:00
|
|
|
AC_CONFIG_SRCDIR([include/cryb/core.h])
|
2014-07-04 11:18:53 +00:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2016-01-09 19:26:40 +00:00
|
|
|
AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz])
|
2014-07-04 11:18:53 +00:00
|
|
|
AM_CONFIG_HEADER([include/config.h])
|
|
|
|
|
2014-07-13 19:59:58 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Toolchain
|
|
|
|
#
|
|
|
|
|
2014-07-04 11:18:53 +00:00
|
|
|
# C compiler and features
|
|
|
|
AC_LANG(C)
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_CC_STDC
|
|
|
|
AC_PROG_CPP
|
2014-10-30 12:55:36 +00:00
|
|
|
AC_GNU_SOURCE
|
2014-07-04 11:18:53 +00:00
|
|
|
AC_C_CONST
|
|
|
|
AC_C_RESTRICT
|
|
|
|
AC_C_VOLATILE
|
|
|
|
AC_C_BIGENDIAN
|
2016-09-15 09:18:01 +00:00
|
|
|
AC_TYPE_INT16_T
|
|
|
|
AC_TYPE_INT32_T
|
|
|
|
AC_TYPE_INT8_T
|
|
|
|
AC_TYPE_INTMAX_T
|
|
|
|
AC_TYPE_INTPTR_T
|
|
|
|
AC_TYPE_OFF_T
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_TYPE_SSIZE_T
|
|
|
|
AC_TYPE_UINT16_T
|
|
|
|
AC_TYPE_UINT32_T
|
|
|
|
AC_TYPE_UINT8_T
|
|
|
|
AC_TYPE_UINTMAX_T
|
|
|
|
AC_TYPE_UINTPTR_T
|
2014-07-04 11:18:53 +00:00
|
|
|
|
|
|
|
# libtool
|
|
|
|
LT_PREREQ([2.2.6])
|
|
|
|
LT_INIT()
|
|
|
|
|
|
|
|
# other programs
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
|
2014-07-13 19:59:58 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Headers and functions
|
|
|
|
#
|
2014-07-04 11:18:53 +00:00
|
|
|
|
2014-07-13 19:59:58 +00:00
|
|
|
AC_CHECK_HEADERS([endian.h sys/endian.h])
|
2016-09-15 09:18:01 +00:00
|
|
|
AX_GCC_BUILTIN([__builtin_bswap16])
|
|
|
|
AX_GCC_BUILTIN([__builtin_bswap32])
|
|
|
|
AX_GCC_BUILTIN([__builtin_bswap64])
|
2015-08-17 15:37:07 +00:00
|
|
|
AC_CHECK_DECLS([
|
2016-09-15 09:18:01 +00:00
|
|
|
bswap16, bswap32, bswap64,
|
2015-08-17 15:37:07 +00:00
|
|
|
be16enc, be16dec, le16enc, le16dec,
|
|
|
|
be32enc, be32dec, le32enc, le32dec,
|
2016-09-15 09:18:01 +00:00
|
|
|
be64enc, be64dec, le64enc, le64dec,
|
|
|
|
htobe16, be16toh, htole16, le16toh,
|
|
|
|
htobe32, be32toh, htole32, le32toh,
|
|
|
|
htobe64, be64toh, htole64, le64toh,
|
|
|
|
nothing
|
2015-08-17 15:37:07 +00:00
|
|
|
], [], [], [[
|
2014-12-20 00:38:54 +00:00
|
|
|
#if HAVE_SYS_ENDIAN_H
|
2014-10-30 13:24:53 +00:00
|
|
|
#include <sys/endian.h>
|
|
|
|
#endif
|
2014-12-20 00:38:54 +00:00
|
|
|
#if HAVE_ENDIAN_H
|
2014-10-30 13:24:53 +00:00
|
|
|
#include <endian.h>
|
|
|
|
#endif
|
|
|
|
]])
|
2014-07-13 19:59:58 +00:00
|
|
|
AC_CHECK_FUNCS([strlcat strlcmp strlcpy])
|
|
|
|
|
2014-10-30 12:05:45 +00:00
|
|
|
# For tracing allocations in unit tests
|
2014-10-30 13:07:16 +00:00
|
|
|
AC_CHECK_HEADERS([sys/uio.h sys/ktrace.h], [], [], [[
|
|
|
|
#include <sys/param.h>
|
2014-12-20 00:38:54 +00:00
|
|
|
#if HAVE_SYS_UIO_H
|
2014-10-30 13:07:16 +00:00
|
|
|
#include <sys/uio.h>
|
|
|
|
#endif
|
|
|
|
]])
|
2014-10-30 12:05:45 +00:00
|
|
|
AC_CHECK_FUNCS([utrace])
|
|
|
|
|
2015-02-15 09:18:18 +00:00
|
|
|
# C11 features
|
|
|
|
# XXX our version has an incorrect prototype due to the lack of a test
|
|
|
|
# for the existence of rsize_t and RSIZE_MAX.
|
|
|
|
AC_CHECK_FUNCS([memset_s])
|
|
|
|
|
2014-10-30 12:55:36 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Extra libraries
|
|
|
|
#
|
|
|
|
|
|
|
|
save_LIBS="${LIBS}"
|
|
|
|
LIBS=""
|
2014-10-30 14:32:46 +00:00
|
|
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
2014-10-30 12:55:36 +00:00
|
|
|
RT_LIBS="${LIBS}"
|
|
|
|
LIBS="${save_LIBS}"
|
|
|
|
AC_SUBST(RT_LIBS)
|
|
|
|
|
2014-07-13 19:59:58 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Build options
|
|
|
|
#
|
2014-07-04 11:18:53 +00:00
|
|
|
|
|
|
|
# Documentation
|
2015-12-14 17:08:22 +00:00
|
|
|
AC_ARG_ENABLE([doc],
|
|
|
|
AC_HELP_STRING([--disable-doc],
|
2014-07-04 11:18:53 +00:00
|
|
|
[do not build the documentation]),
|
2016-09-04 12:56:39 +00:00
|
|
|
[with_doc=$enableval])
|
|
|
|
AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
|
2014-07-04 11:18:53 +00:00
|
|
|
|
2014-07-13 19:59:58 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Debugging
|
|
|
|
#
|
|
|
|
|
|
|
|
# OpenSSL versions of the unit tests for comparison
|
2015-12-14 17:08:22 +00:00
|
|
|
AC_ARG_ENABLE([openssl-tests],
|
|
|
|
AC_HELP_STRING([--enable-openssl-tests],
|
|
|
|
[build unit tests with OpenSSL support]))
|
|
|
|
AM_CONDITIONAL([OPENSSL_TESTS], [test x"$enable_openssl_tests" = x"yes"])
|
2014-07-13 19:59:58 +00:00
|
|
|
|
|
|
|
# RSAREF versions of the unit tests for comparison
|
2015-12-14 17:08:22 +00:00
|
|
|
AC_ARG_ENABLE([rsaref-tests],
|
|
|
|
AC_HELP_STRING([--enable-rsaref-tests],
|
|
|
|
[build unit tests enable RSAREF support]))
|
|
|
|
AM_CONDITIONAL([RSAREF_TESTS], [test x"enable_rsaref_tests" = x"yes"])
|
2014-07-13 19:59:58 +00:00
|
|
|
|
2014-07-04 11:18:53 +00:00
|
|
|
# Developer-friendly compiler flags
|
|
|
|
AC_ARG_ENABLE([developer-warnings],
|
|
|
|
AS_HELP_STRING([--enable-developer-warnings],
|
|
|
|
[enable strict warnings (default is NO)]),
|
2016-01-09 17:37:05 +00:00
|
|
|
[CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -Wshadow"])
|
2014-07-04 11:18:53 +00:00
|
|
|
AC_ARG_ENABLE([debugging-symbols],
|
|
|
|
AS_HELP_STRING([--enable-debugging-symbols],
|
|
|
|
[enable debugging symbols (default is NO)]),
|
|
|
|
[CFLAGS="${CFLAGS} -O0 -g -fno-inline"])
|
|
|
|
AC_ARG_ENABLE([werror],
|
|
|
|
AS_HELP_STRING([--enable-werror],
|
|
|
|
[use -Werror (default is NO)]),
|
|
|
|
[CFLAGS="${CFLAGS} -Werror"])
|
|
|
|
|
2015-12-14 17:08:22 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Components
|
|
|
|
#
|
|
|
|
|
|
|
|
# Everything
|
|
|
|
AC_ARG_ENABLE([all],
|
|
|
|
AC_HELP_STRING([--disable-all],
|
|
|
|
[disable all libraries and tools]),
|
|
|
|
[enable_all=$enableval],
|
|
|
|
[enable_all=yes])
|
|
|
|
|
|
|
|
# Ciphers
|
|
|
|
elements="$elements cipher"
|
|
|
|
requires="$requires cipher:core"
|
|
|
|
AC_ARG_ENABLE([cryb-cipher],
|
|
|
|
AC_HELP_STRING([--enable-cryb-cipher],
|
|
|
|
[build the cipher library]),
|
|
|
|
[enable_cryb_cipher=$enableval],
|
|
|
|
[enable_cryb_cipher=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_CIPHER], [test x"$enable_cryb_cipher" = x"yes"])
|
|
|
|
|
|
|
|
# CPE
|
|
|
|
elements="$elements cpe"
|
|
|
|
requires="$requires cpe:core"
|
|
|
|
AC_ARG_ENABLE([cryb-cpe],
|
|
|
|
AC_HELP_STRING([--enable-cryb-cpe],
|
|
|
|
[build the CPE library]),
|
|
|
|
[enable_cryb_cpe=$enableval],
|
|
|
|
[enable_cryb_cpe=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_CPE], [test x"$enable_cryb_cpe" = x"yes"])
|
|
|
|
|
|
|
|
# Core
|
|
|
|
elements="$elements core"
|
|
|
|
AC_ARG_ENABLE([cryb-core],
|
|
|
|
AC_HELP_STRING([--enable-cryb-core],
|
|
|
|
[build the core library]),
|
|
|
|
[enable_cryb_core=$enableval],
|
|
|
|
[enable_cryb_core=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_CORE], [test x"$enable_cryb_core" = x"yes"])
|
|
|
|
|
|
|
|
# Message digests
|
|
|
|
elements="$elements digest"
|
|
|
|
requires="$requires digests:core"
|
|
|
|
AC_ARG_ENABLE([cryb-digest],
|
|
|
|
AC_HELP_STRING([--enable-cryb-digest],
|
|
|
|
[build the message digest library]),
|
|
|
|
[enable_cryb_digest=$enableval],
|
|
|
|
[enable_cryb_digest=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_DIGEST], [test x"$enable_cryb_digest" = x"yes"])
|
|
|
|
|
|
|
|
# Encodings
|
|
|
|
elements="$elements enc"
|
|
|
|
requires="$requires env:core"
|
|
|
|
AC_ARG_ENABLE([cryb-enc],
|
|
|
|
AC_HELP_STRING([--enable-cryb-enc],
|
|
|
|
[build the encoding library]),
|
|
|
|
[enable_cryb_enc=$enableval],
|
|
|
|
[enable_cryb_enc=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_ENC], [test x"$enable_cryb_enc" = x"yes"])
|
|
|
|
|
|
|
|
# Non-cryptographic hashes
|
|
|
|
elements="$elements hash"
|
|
|
|
requires="$requires hash:core"
|
|
|
|
AC_ARG_ENABLE([cryb-hash],
|
|
|
|
AC_HELP_STRING([--enable-cryb-hash],
|
|
|
|
[build the non-cryptographic hash library]),
|
|
|
|
[enable_cryb_hash=$enableval],
|
|
|
|
[enable_cryb_hash=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_HASH], [test x"$enable_cryb_hash" = x"yes"])
|
|
|
|
|
|
|
|
# Message authentication codes
|
|
|
|
elements="$elements mac"
|
|
|
|
requires="$requires mac:core"
|
|
|
|
AC_ARG_ENABLE([cryb-mac],
|
|
|
|
AC_HELP_STRING([--enable-cryb-mac],
|
|
|
|
[build the message authentication code library]),
|
|
|
|
[enable_cryb_mac=$enableval],
|
|
|
|
[enable_cryb_mac=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_MAC], [test x"$enable_cryb_digest" = x"yes"])
|
|
|
|
|
|
|
|
# Multiple-precision integers
|
|
|
|
elements="$elements mpi"
|
|
|
|
requires="$requires mpi:core"
|
|
|
|
AC_ARG_ENABLE([cryb-mpi],
|
|
|
|
AC_HELP_STRING([--enable-cryb-mpi],
|
|
|
|
[build the multiple-precision math library]),
|
|
|
|
[enable_cryb_mpi=$enableval],
|
|
|
|
[enable_cryb_mpi=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_MPI], [test x"$enable_cryb_digest" = x"yes"])
|
|
|
|
|
|
|
|
# OATH
|
|
|
|
elements="$elements oath"
|
|
|
|
requires="$requires oath:core oath:digest oath:mac oath:enc"
|
|
|
|
AC_ARG_ENABLE([cryb-oath],
|
|
|
|
AC_HELP_STRING([--enable-cryb-oath],
|
|
|
|
[build the OATH library]),
|
|
|
|
[enable_cryb_oath=$enableval],
|
|
|
|
[enable_cryb_oath=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_OATH], [test x"$enable_cryb_oath" = x"yes"])
|
|
|
|
|
|
|
|
# Pseudo-randomness
|
|
|
|
elements="$elements rand"
|
|
|
|
requires="$requires rand:core"
|
|
|
|
AC_ARG_ENABLE([cryb-rand],
|
|
|
|
AC_HELP_STRING([--enable-cryb-rand],
|
|
|
|
[build the pseudo-randomness library]),
|
|
|
|
[enable_cryb_rand=$enableval],
|
|
|
|
[enable_cryb_rand=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_RAND], [test x"$enable_cryb_rand" = x"yes"])
|
|
|
|
|
|
|
|
# Test framework
|
|
|
|
elements="$elements test"
|
|
|
|
requires="$requires test:core"
|
|
|
|
AC_ARG_ENABLE([cryb-test],
|
|
|
|
AC_HELP_STRING([--enable-cryb-test],
|
|
|
|
[build the test framework]),
|
|
|
|
[enable_cryb_test=$enableval],
|
|
|
|
[enable_cryb_test=$enable_all])
|
|
|
|
AM_CONDITIONAL([CRYB_TEST], [test x"$enable_cryb_test" = x"yes"])
|
|
|
|
|
|
|
|
# Check dependencies
|
|
|
|
AC_MSG_CHECKING([dependencies])
|
|
|
|
for req in $requires ; do
|
|
|
|
lhs=${req%:*}
|
|
|
|
lhs_ena=`eval echo \\\$enable_cryb_$lhs`
|
|
|
|
if test x"$lhs_ena" = x"yes" ; then
|
|
|
|
rhs=${req#*:}
|
|
|
|
rhs_ena=`eval echo \\\$enable_cryb_$rhs`
|
|
|
|
if test x"$rhs_ena" != x"yes" ; then
|
|
|
|
AC_MSG_ERROR([cryb-$lhs requires cryb-$rhs])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
AC_MSG_RESULT([ok])
|
|
|
|
|
2014-07-13 19:59:58 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Output
|
|
|
|
#
|
2014-07-04 11:18:53 +00:00
|
|
|
|
|
|
|
AC_CONFIG_FILES([
|
|
|
|
Makefile
|
|
|
|
include/Makefile
|
|
|
|
include/cryb/Makefile
|
|
|
|
lib/Makefile
|
2015-10-03 14:24:59 +00:00
|
|
|
lib/cipher/Makefile
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/core/Makefile
|
2014-08-01 14:18:25 +00:00
|
|
|
lib/cpe/Makefile
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/digest/Makefile
|
|
|
|
lib/enc/Makefile
|
2014-07-19 06:03:57 +00:00
|
|
|
lib/hash/Makefile
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/mac/Makefile
|
2014-08-12 07:30:31 +00:00
|
|
|
lib/mpi/Makefile
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/oath/Makefile
|
|
|
|
lib/rand/Makefile
|
|
|
|
lib/rsaref/Makefile
|
2015-10-04 07:49:48 +00:00
|
|
|
lib/test/Makefile
|
2014-07-04 11:18:53 +00:00
|
|
|
t/Makefile
|
|
|
|
])
|
2014-12-20 02:58:11 +00:00
|
|
|
AC_CONFIG_FILES([mkpkgng], [chmod +x mkpkgng])
|
2014-12-20 00:52:37 +00:00
|
|
|
AC_CONFIG_FILES([tools/coverage.sh], [chmod +x tools/coverage.sh])
|
2014-07-04 11:18:53 +00:00
|
|
|
AC_OUTPUT
|
2015-12-14 17:08:22 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo The following Cryb components will be built:
|
|
|
|
echo
|
|
|
|
for elem in $elements ; do
|
|
|
|
enable=`eval echo \\\$enable_cryb_$elem`
|
|
|
|
printf "%16s: %s\n" $elem ${enable:-no}
|
|
|
|
done
|
|
|
|
echo
|