2020-10-04 01:15:14 +03:00
|
|
|
|
# -*- Autoconf -*-
|
|
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
|
|
2020-10-12 21:58:09 +03:00
|
|
|
|
# There are two versions numbers that must be updated on each public release.
|
|
|
|
|
# 1. The libtool version (useful to the linker)
|
|
|
|
|
# 2. The semantic version (useful to humans)
|
|
|
|
|
|
|
|
|
|
# Follow these instructions sequentially for the libtool version:
|
|
|
|
|
# 1. If the library source code has changed at all since the last update,
|
|
|
|
|
# then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
|
|
|
|
|
# 2. If any interfaces have been added, removed, or changed since the last
|
|
|
|
|
# update, increment current, and set revision to 0.
|
|
|
|
|
# 3. If any interfaces have been added since the last public release,
|
|
|
|
|
# then increment age.
|
|
|
|
|
# 4. If any interfaces have been removed or changed since the last public
|
|
|
|
|
# release, then set age to 0.
|
|
|
|
|
m4_define([urcrypt_lt_current], [0])
|
|
|
|
|
m4_define([urcrypt_lt_revision], [0])
|
|
|
|
|
m4_define([urcrypt_lt_age], [0])
|
|
|
|
|
|
|
|
|
|
# The package version uses semantic versioning (semver.org).
|
|
|
|
|
# In summary,increment the:
|
|
|
|
|
# 1. MAJOR version when you make incompatible API changes,
|
|
|
|
|
# 2. MINOR version when you add functionality in a backwards compatible manner, and
|
|
|
|
|
# 3. PATCH version when you make backwards compatible bug fixes.
|
|
|
|
|
m4_define([urcrypt_sv_major], [0])
|
|
|
|
|
m4_define([urcrypt_sv_minor], [1])
|
|
|
|
|
m4_define([urcrypt_sv_patch], [0])
|
|
|
|
|
|
2020-10-05 20:31:45 +03:00
|
|
|
|
# Initialize autoconf
|
2020-10-04 01:15:14 +03:00
|
|
|
|
AC_PREREQ([2.69])
|
2020-10-12 21:58:09 +03:00
|
|
|
|
AC_INIT([urcrypt], [urcrypt_sv_major.urcrypt_sv_minor.urcrypt_sv_patch])
|
|
|
|
|
AC_SUBST([URCRYPT_API_VERSION], [urcrypt_sv_major])
|
|
|
|
|
AC_SUBST([URCRYPT_LT_VERSION],
|
|
|
|
|
[urcrypt_lt_current:urcrypt_lt_revision:urcrypt_lt_age])
|
|
|
|
|
|
2020-10-11 01:01:31 +03:00
|
|
|
|
AC_CONFIG_SRCDIR([urcrypt/util.c])
|
2020-10-04 01:15:14 +03:00
|
|
|
|
AC_CONFIG_HEADERS([config.h])
|
|
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
|
|
|
|
AC_CONFIG_MACRO_DIR([build-aux/m4])
|
2020-10-07 00:23:22 +03:00
|
|
|
|
AC_CANONICAL_HOST
|
2020-10-05 20:31:45 +03:00
|
|
|
|
|
|
|
|
|
# Initialize automake
|
2020-10-04 01:15:14 +03:00
|
|
|
|
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])
|
2020-10-05 20:31:45 +03:00
|
|
|
|
|
|
|
|
|
# Initialize libtool
|
2020-10-04 01:15:14 +03:00
|
|
|
|
AM_PROG_AR
|
|
|
|
|
LT_INIT
|
2020-10-05 20:31:45 +03:00
|
|
|
|
|
2020-10-09 23:40:31 +03:00
|
|
|
|
# Initialize pkgconfig
|
|
|
|
|
PKG_PROG_PKG_CONFIG
|
|
|
|
|
PKG_INSTALLDIR
|
|
|
|
|
|
2020-10-05 20:31:45 +03:00
|
|
|
|
# Checks for programs
|
2020-10-04 01:15:14 +03:00
|
|
|
|
AC_PROG_CC
|
|
|
|
|
|
2020-10-05 20:31:45 +03:00
|
|
|
|
# Checks for pkg-config capable libraries
|
2020-10-12 21:58:09 +03:00
|
|
|
|
PKG_CHECK_MODULES([LIBSECP256K1], [libsecp256k1])
|
2020-10-12 23:17:11 +03:00
|
|
|
|
AC_CHECK_HEADER([secp256k1_recovery.h], [],
|
|
|
|
|
[AC_MSG_ERROR([libsecp256k1 must have recovery enabled.])])
|
2020-10-12 21:58:09 +03:00
|
|
|
|
PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
|
2020-10-07 00:23:22 +03:00
|
|
|
|
|
|
|
|
|
AS_IF([test "$enable_shared" == "yes"],
|
|
|
|
|
[# ensure crypto will be shared for shared object (see README.md)
|
|
|
|
|
save_LDFLAGS=$LDFLAGS
|
|
|
|
|
save_CLAGS=$CFLAGS
|
2020-10-12 21:58:09 +03:00
|
|
|
|
LDFLAGS=$LIBCRYPTO_LIBS
|
|
|
|
|
CFLAGS=$LIBCRYPTO_CFLAGS
|
2020-10-12 23:17:11 +03:00
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <openssl/sha.h>],
|
|
|
|
|
[[unsigned char sha[32];
|
|
|
|
|
SHA256("hello", 5, sha);]])],
|
2020-10-07 00:23:22 +03:00
|
|
|
|
[AC_PROG_GREP
|
|
|
|
|
AC_CHECK_TOOL([NM], [nm])
|
2020-10-07 01:37:49 +03:00
|
|
|
|
AC_MSG_CHECKING([for shared libcrypto])
|
2020-10-07 00:23:22 +03:00
|
|
|
|
AS_IF(
|
2021-08-06 03:53:47 +03:00
|
|
|
|
[$NM conftest$EXEEXT | $GREP 'U .*SHA256' 2>&1 >/dev/null],
|
2020-10-07 00:23:22 +03:00
|
|
|
|
[AC_MSG_RESULT([yes])],
|
|
|
|
|
[AC_MSG_ERROR([cannot find shared object for libcrypto.])])],
|
|
|
|
|
[AC_MSG_ERROR([unable to link libcrypto.])])
|
|
|
|
|
LDFLAGS=$save_LDFLAGS
|
|
|
|
|
CFLAGS=$save_CFLAGS])
|
2020-10-04 03:01:56 +03:00
|
|
|
|
|
2020-10-05 20:31:45 +03:00
|
|
|
|
# Checks for non pkg-config libraries
|
2020-10-07 00:23:22 +03:00
|
|
|
|
AC_CHECK_LIB([aes_siv], [AES_SIV_CTX_new],
|
2020-10-12 21:58:09 +03:00
|
|
|
|
[AC_SUBST([LIBAES_SIV_LIBS], "-laes_siv")],
|
2020-10-07 00:23:22 +03:00
|
|
|
|
[AC_MSG_ERROR([libaes_siv is required.])])
|
2020-10-04 01:15:14 +03:00
|
|
|
|
|
|
|
|
|
# Checks for header files.
|
|
|
|
|
AC_CHECK_HEADERS([limits.h stddef.h stdint.h stdlib.h string.h])
|
|
|
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
|
AC_CHECK_HEADER_STDBOOL
|
|
|
|
|
AC_TYPE_INT32_T
|
|
|
|
|
AC_TYPE_INT64_T
|
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
|
AC_TYPE_UINT32_T
|
|
|
|
|
AC_TYPE_UINT64_T
|
|
|
|
|
AC_TYPE_UINT8_T
|
|
|
|
|
|
|
|
|
|
# Checks for library functions.
|
|
|
|
|
AC_CHECK_FUNCS([memset])
|
|
|
|
|
|
2020-10-05 20:31:45 +03:00
|
|
|
|
# Finish and output
|
2020-10-12 21:58:09 +03:00
|
|
|
|
AC_CONFIG_FILES([Makefile liburcrypt-$URCRYPT_API_VERSION.pc:liburcrypt.pc.in])
|
2020-10-04 01:15:14 +03:00
|
|
|
|
AC_OUTPUT
|