2014-07-04 11:18:53 +00:00
|
|
|
AC_PREREQ([2.63])
|
2018-04-26 01:32:56 +00:00
|
|
|
AC_INIT([cryb.to], [0.20180426], [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])
|
2018-05-05 13:26:17 +00:00
|
|
|
AM_MAINTAINER_MODE([enable])
|
2014-07-04 11:18:53 +00:00
|
|
|
|
2014-07-13 19:59:58 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Toolchain
|
|
|
|
#
|
|
|
|
|
2014-07-04 11:18:53 +00:00
|
|
|
# C compiler and features
|
|
|
|
AC_LANG(C)
|
2017-01-24 14:08:48 +00:00
|
|
|
AC_PROG_CC([clang gcc cc])
|
2014-07-04 11:18:53 +00:00
|
|
|
AC_PROG_CC_STDC
|
|
|
|
AC_PROG_CPP
|
2017-01-24 14:08:48 +00:00
|
|
|
AC_PROG_CXX([clang++ g++ c++])
|
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
|
2017-04-05 18:58:46 +00:00
|
|
|
|
|
|
|
# libtool
|
|
|
|
LT_PREREQ([2.2.6])
|
|
|
|
LT_INIT()
|
|
|
|
|
|
|
|
# pkg-config
|
2017-05-05 23:24:27 +00:00
|
|
|
AX_PROG_PKG_CONFIG
|
2017-04-05 18:58:46 +00:00
|
|
|
|
|
|
|
# other programs
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
|
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Types
|
|
|
|
#
|
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
|
|
|
|
2018-05-06 02:19:26 +00:00
|
|
|
AC_CHECK_TYPES([rsize_t], [], [], [[#include <stdint.h>]])
|
|
|
|
AC_CHECK_DECL([RSIZE_MAX], [], [], [[#include <stdint.h>]])
|
|
|
|
|
2014-07-13 19:59:58 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Headers and functions
|
|
|
|
#
|
2014-07-04 11:18:53 +00:00
|
|
|
|
2017-04-05 18:58:46 +00:00
|
|
|
AC_CHECK_HEADERS([endian.h sys/endian.h strings.h])
|
2016-09-15 09:18:01 +00:00
|
|
|
AX_GCC_BUILTIN([__builtin_bswap16])
|
|
|
|
AX_GCC_BUILTIN([__builtin_bswap32])
|
|
|
|
AX_GCC_BUILTIN([__builtin_bswap64])
|
2017-04-05 18:58:46 +00:00
|
|
|
AX_GCC_BUILTIN([__builtin_clz])
|
|
|
|
AX_GCC_BUILTIN([__builtin_clzl])
|
|
|
|
AX_GCC_BUILTIN([__builtin_clzll])
|
|
|
|
AX_GCC_BUILTIN([__builtin_ctz])
|
|
|
|
AX_GCC_BUILTIN([__builtin_ctzl])
|
|
|
|
AX_GCC_BUILTIN([__builtin_ctzll])
|
|
|
|
AX_GCC_BUILTIN([__builtin_ffs])
|
|
|
|
AX_GCC_BUILTIN([__builtin_ffsl])
|
|
|
|
AX_GCC_BUILTIN([__builtin_ffsll])
|
|
|
|
# No compiler we know of has these
|
|
|
|
#AX_GCC_BUILTIN([__builtin_fls])
|
|
|
|
#AX_GCC_BUILTIN([__builtin_flsl])
|
|
|
|
#AX_GCC_BUILTIN([__builtin_flsll])
|
2015-08-17 15:37:07 +00:00
|
|
|
AC_CHECK_DECLS([
|
2016-09-15 09:18:01 +00:00
|
|
|
bswap16, bswap32, bswap64,
|
2017-03-19 18:00:01 +00:00
|
|
|
bswap16v, bswap32v, bswap64v,
|
2015-08-17 15:37:07 +00:00
|
|
|
be16enc, be16dec, le16enc, le16dec,
|
2017-03-19 18:00:01 +00:00
|
|
|
be16encv, be16decv, le16encv, le16decv,
|
2015-08-17 15:37:07 +00:00
|
|
|
be32enc, be32dec, le32enc, le32dec,
|
2017-03-19 18:00:01 +00:00
|
|
|
be32encv, be32decv, le32encv, le32decv,
|
2016-09-15 09:18:01 +00:00
|
|
|
be64enc, be64dec, le64enc, le64dec,
|
2017-03-19 18:00:01 +00:00
|
|
|
be64encv, be64decv, le64encv, le64decv,
|
2016-09-15 09:18:01 +00:00
|
|
|
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
|
|
|
|
]])
|
2017-04-05 18:58:46 +00:00
|
|
|
AC_CHECK_FUNCS([ffs ffsl ffsll fls flsl flsll], [], [], [[
|
|
|
|
#if HAVE_STRINGS_H
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
|
|
|
]])
|
2017-08-21 16:31:29 +00:00
|
|
|
AC_CHECK_FUNCS([strchrnul strlcat strlcmp strlcpy])
|
|
|
|
AC_CHECK_FUNCS([wcschrnul wcslcat wcslcmp wcslcpy])
|
2014-07-13 19:59:58 +00:00
|
|
|
|
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])
|
|
|
|
|
2016-11-14 11:42:57 +00:00
|
|
|
# Used in some unit tests
|
|
|
|
AC_CHECK_HEADERS([sys/resource.h])
|
|
|
|
AC_CHECK_FUNCS([setrlimit])
|
|
|
|
|
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.
|
2015-12-15 23:50:36 +00:00
|
|
|
AC_CHECK_FUNCS([memcpy_s memset_s])
|
2015-02-15 09:18:18 +00:00
|
|
|
|
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],
|
2017-05-05 22:53:32 +00:00
|
|
|
AS_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],
|
2017-05-05 22:53:32 +00:00
|
|
|
AS_HELP_STRING([--enable-openssl-tests],
|
2015-12-14 17:08:22 +00:00
|
|
|
[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],
|
2017-05-05 22:53:32 +00:00
|
|
|
AS_HELP_STRING([--enable-rsaref-tests],
|
2015-12-14 17:08:22 +00:00
|
|
|
[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
|
|
|
|
2017-12-17 13:03:26 +00:00
|
|
|
XFLAGS=""
|
|
|
|
|
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)]),
|
2017-12-17 13:03:26 +00:00
|
|
|
[XFLAGS="${XFLAGS} -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)]),
|
2017-12-17 13:03:26 +00:00
|
|
|
[XFLAGS="${XFLAGS} -O0 -fno-inline -g"])
|
2014-07-04 11:18:53 +00:00
|
|
|
AC_ARG_ENABLE([werror],
|
|
|
|
AS_HELP_STRING([--enable-werror],
|
|
|
|
[use -Werror (default is NO)]),
|
2017-12-17 13:03:26 +00:00
|
|
|
[XFLAGS="${XFLAGS} -Werror"])
|
|
|
|
|
|
|
|
CFLAGS="${CFLAGS} ${XFLAGS}"
|
|
|
|
CXXFLAGS="${CXXFLAGS} ${XFLAGS}"
|
|
|
|
unset XFLAGS
|
2014-07-04 11:18:53 +00:00
|
|
|
|
2015-12-14 17:08:22 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
# Components
|
|
|
|
#
|
|
|
|
|
2018-05-06 01:02:55 +00:00
|
|
|
CRYB_INIT
|
|
|
|
|
|
|
|
CRYB_LIB_PROVIDE([cipher], [core])
|
|
|
|
CRYB_LIB_PROVIDE([core], [])
|
|
|
|
CRYB_LIB_PROVIDE([cpe], [core])
|
|
|
|
CRYB_LIB_PROVIDE([digest], [core])
|
|
|
|
CRYB_LIB_PROVIDE([enc], [core])
|
|
|
|
CRYB_LIB_PROVIDE([hash], [core])
|
|
|
|
CRYB_LIB_PROVIDE([mac], [core digest])
|
|
|
|
CRYB_LIB_PROVIDE([mpi], [core])
|
|
|
|
CRYB_LIB_PROVIDE([oath], [core digest enc mac rand])
|
|
|
|
CRYB_LIB_PROVIDE([rand], [core])
|
|
|
|
CRYB_LIB_PROVIDE([test], [core])
|
|
|
|
|
|
|
|
CRYB_CHECK_DEPENDENCIES
|
2015-12-14 17:08:22 +00:00
|
|
|
|
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
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/cipher/cryb-cipher.pc
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/core/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/core/cryb-core.pc
|
2014-08-01 14:18:25 +00:00
|
|
|
lib/cpe/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/cpe/cryb-cpe.pc
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/digest/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/digest/cryb-digest.pc
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/enc/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/enc/cryb-enc.pc
|
2014-07-19 06:03:57 +00:00
|
|
|
lib/hash/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/hash/cryb-hash.pc
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/mac/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/mac/cryb-mac.pc
|
2014-08-12 07:30:31 +00:00
|
|
|
lib/mpi/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/mpi/cryb-mpi.pc
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/oath/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/oath/cryb-oath.pc
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/rand/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/rand/cryb-rand.pc
|
2014-07-04 11:18:53 +00:00
|
|
|
lib/rsaref/Makefile
|
2015-10-04 07:49:48 +00:00
|
|
|
lib/test/Makefile
|
2017-03-06 23:50:17 +00:00
|
|
|
lib/test/cryb-test.pc
|
2014-07-04 11:18:53 +00:00
|
|
|
t/Makefile
|
2017-03-08 23:11:29 +00:00
|
|
|
freebsd/Makefile
|
2014-07-04 11:18:53 +00:00
|
|
|
])
|
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
|
|
|
|
2018-05-06 01:02:55 +00:00
|
|
|
CRYB_SUMMARY
|