mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-14 09:45:40 +00:00
Merge pull request #16 from cryb-to/autoconf
Create a set of autoconf macros to handle Cryb components and dependencies.
This commit is contained in:
commit
1a86caaf37
15 changed files with 228 additions and 161 deletions
|
@ -14,3 +14,8 @@ EXTRA_DIST = \
|
|||
m4/ax_pkg_config.m4 \
|
||||
tools/coverage.sh.in \
|
||||
tools/setprops.sh
|
||||
|
||||
if CRYB_CORE
|
||||
aclocaldir = $(datarootdir)/aclocal
|
||||
aclocal_DATA = m4/cryb_to.m4
|
||||
endif CRYB_CORE
|
||||
|
|
150
configure.ac
150
configure.ac
|
@ -186,136 +186,21 @@ unset XFLAGS
|
|||
# Components
|
||||
#
|
||||
|
||||
# Everything
|
||||
AC_ARG_ENABLE([all],
|
||||
AS_HELP_STRING([--disable-all],
|
||||
[disable all libraries and tools]),
|
||||
[enable_all=$enableval],
|
||||
[enable_all=yes])
|
||||
CRYB_INIT
|
||||
|
||||
# Ciphers
|
||||
elements="$elements cipher"
|
||||
requires="$requires cipher:core"
|
||||
AC_ARG_ENABLE([cryb-cipher],
|
||||
AS_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"])
|
||||
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])
|
||||
|
||||
# Core
|
||||
elements="$elements core"
|
||||
AC_ARG_ENABLE([cryb-core],
|
||||
AS_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"])
|
||||
|
||||
# CPE
|
||||
elements="$elements cpe"
|
||||
requires="$requires cpe:core"
|
||||
AC_ARG_ENABLE([cryb-cpe],
|
||||
AS_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"])
|
||||
|
||||
# Message digests
|
||||
elements="$elements digest"
|
||||
requires="$requires digests:core"
|
||||
AC_ARG_ENABLE([cryb-digest],
|
||||
AS_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 enc:core"
|
||||
AC_ARG_ENABLE([cryb-enc],
|
||||
AS_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],
|
||||
AS_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 mac:digest"
|
||||
AC_ARG_ENABLE([cryb-mac],
|
||||
AS_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],
|
||||
AS_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_mpi" = x"yes"])
|
||||
|
||||
# OATH
|
||||
elements="$elements oath"
|
||||
requires="$requires oath:core oath:digest oath:enc oath:mac oath:rand"
|
||||
AC_ARG_ENABLE([cryb-oath],
|
||||
AS_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],
|
||||
AS_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],
|
||||
AS_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])
|
||||
CRYB_CHECK_DEPENDENCIES
|
||||
|
||||
############################################################################
|
||||
#
|
||||
|
@ -356,11 +241,4 @@ AC_CONFIG_FILES([
|
|||
AC_CONFIG_FILES([tools/coverage.sh], [chmod +x tools/coverage.sh])
|
||||
AC_OUTPUT
|
||||
|
||||
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
|
||||
CRYB_SUMMARY
|
||||
|
|
|
@ -11,7 +11,10 @@ libcryb_cipher_la_SOURCES = \
|
|||
\
|
||||
cryb_cipher.c
|
||||
|
||||
libcryb_cipher_la_CFLAGS = \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_cipher_la_LIBADD = \
|
||||
$(top_builddir)/lib/core/libcryb-core.la
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-cipher.pc
|
||||
|
|
|
@ -15,7 +15,10 @@ libcryb_cpe_la_SOURCES = \
|
|||
\
|
||||
cryb_cpe.c
|
||||
|
||||
libcryb_cpe_la_CFLAGS = \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_cpe_la_LIBADD = \
|
||||
$(top_builddir)/lib/core/libcryb-core.la
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-cpe.pc
|
||||
|
|
|
@ -21,7 +21,10 @@ dist_man3_MANS = \
|
|||
cryb_sha384.3 \
|
||||
cryb_sha512.3
|
||||
|
||||
libcryb_digest_la_CFLAGS = \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_digest_la_LIBADD = \
|
||||
$(top_builddir)/lib/core/libcryb-core.la
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-digest.pc
|
||||
|
|
|
@ -15,7 +15,10 @@ libcryb_enc_la_SOURCES = \
|
|||
dist_man3_MANS = \
|
||||
cryb_percent.3
|
||||
|
||||
libcryb_enc_la_CFLAGS = \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_enc_la_LIBADD = \
|
||||
$(top_builddir)/lib/core/libcryb-core.la
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-enc.pc
|
||||
|
|
|
@ -19,7 +19,10 @@ dist_man3_MANS = \
|
|||
\
|
||||
cryb_hash.3
|
||||
|
||||
libcryb_hash_la_CFLAGS = \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_hash_la_LIBADD = \
|
||||
$(top_builddir)/lib/core/libcryb-core.la
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-hash.pc
|
||||
|
|
|
@ -11,8 +11,12 @@ libcryb_mac_la_SOURCES = \
|
|||
\
|
||||
cryb_mac.c
|
||||
|
||||
libcryb_mac_la_CFLAGS = \
|
||||
$(CRYB_DIGEST_CFLAGS) \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_mac_la_LIBADD = \
|
||||
$(top_builddir)/lib/core/libcryb-core.la \
|
||||
$(top_builddir)/lib/digest/libcryb-digest.la
|
||||
$(CRYB_DIGEST_LIBS) \
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-mac.pc
|
||||
|
|
|
@ -43,7 +43,10 @@ libcryb_mpi_la_SOURCES = \
|
|||
noinst_HEADERS = \
|
||||
cryb_mpi_impl.h
|
||||
|
||||
libcryb_mpi_la_CFLAGS = \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_mpi_la_LIBADD = \
|
||||
$(top_builddir)/lib/core/libcryb-core.la
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-mpi.pc
|
||||
|
|
|
@ -15,11 +15,18 @@ libcryb_oath_la_SOURCES = \
|
|||
\
|
||||
cryb_oath.c
|
||||
|
||||
libcryb_oath_la_CFLAGS = \
|
||||
$(CRYB_DIGEST_CFLAGS) \
|
||||
$(CRYB_ENC_CFLAGS) \
|
||||
$(CRYB_MAC_CFLAGS) \
|
||||
$(CRYB_RAND_CFLAGS) \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_oath_la_LIBADD = \
|
||||
$(top_builddir)/lib/digest/libcryb-digest.la \
|
||||
$(top_builddir)/lib/enc/libcryb-enc.la \
|
||||
$(top_builddir)/lib/mac/libcryb-mac.la \
|
||||
$(top_builddir)/lib/rand/libcryb-rand.la \
|
||||
$(top_builddir)/lib/core/libcryb-core.la
|
||||
$(CRYB_DIGEST_LIBS) \
|
||||
$(CRYB_ENC_LIBS) \
|
||||
$(CRYB_MAC_LIBS) \
|
||||
$(CRYB_RAND_LIBS) \
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-oath.pc
|
||||
|
|
|
@ -7,7 +7,10 @@ libcryb_rand_la_SOURCES = \
|
|||
\
|
||||
cryb_rand.c
|
||||
|
||||
libcryb_rand_la_CFLAGS = \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_rand_la_LIBADD = \
|
||||
$(top_builddir)/lib/core/libcryb-core.la
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-rand.pc
|
||||
|
|
|
@ -10,7 +10,10 @@ libcryb_test_la_SOURCES = \
|
|||
\
|
||||
cryb_test.c
|
||||
|
||||
libcryb_test_la_CFLAGS = \
|
||||
$(CRYB_CORE_CFLAGS)
|
||||
|
||||
libcryb_test_la_LIBADD = \
|
||||
$(top_builddir)/lib/core/libcryb-core.la
|
||||
$(CRYB_CORE_LIBS)
|
||||
|
||||
pkgconfig_DATA = cryb-test.pc
|
||||
|
|
1
m4/.gitignore
vendored
1
m4/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
/*.m4
|
||||
!/ax_gcc_builtin.m4
|
||||
!/ax_pkg_config.m4
|
||||
!/cryb_to.m4
|
||||
|
|
|
@ -28,7 +28,7 @@ dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|||
dnl SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
m4_define([AX_PKG_CONFIG_MACROS_VERSION], [0.20170404])
|
||||
m4_define([AX_PKG_CONFIG_MACROS_VERSION], [0.20180506])
|
||||
|
||||
dnl
|
||||
dnl AX_PROG_PKG_CONFIG([min-version])
|
||||
|
@ -39,8 +39,10 @@ dnl
|
|||
AC_DEFUN([AX_PROG_PKG_CONFIG], [
|
||||
m4_pattern_forbid([^AX_PKG_CONFIG_[A-Z_]+$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config binary])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [list of directories to prepend to default search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [list of directories to search instead of default search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH],
|
||||
[list of directories to prepend to default search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR],
|
||||
[list of directories to search instead of default search path])
|
||||
if test x"${PKG_CONFIG}" = x"" ; then
|
||||
AC_PATH_PROGS([PKG_CONFIG], [pkgconf pkg-config]) >/dev/null
|
||||
else
|
||||
|
@ -97,12 +99,17 @@ AC_DEFUN([AX_PKG_CONFIG_VAR], [
|
|||
])
|
||||
|
||||
dnl
|
||||
dnl AX_PKG_CONFIG_CHECK(package-name,
|
||||
dnl AX_PKG_CONFIG_CHECK(package-name, [version-spec],
|
||||
dnl [action-if-found], [action-if-not-found])
|
||||
dnl -------------------------------------------
|
||||
dnl
|
||||
dnl Check if the specified package is installed. If it is, define
|
||||
dnl HAVE_PACKAGE, PACKAGE_VERSION, PACKAGE_CFLAGS and PACKAGE_LIBS.
|
||||
dnl
|
||||
dnl The second argument, if non-empty, specifies a minimum (>=1.2.3 or
|
||||
dnl >1.2.3), maximum (<=1.2.3 or <1.2.3) or exact (==1.2.3 or =1.2.3
|
||||
dnl or 1.2.3) version to look for.
|
||||
dnl
|
||||
dnl The specified actions are performed in addition to the standard
|
||||
dnl actions.
|
||||
dnl
|
||||
|
@ -110,10 +117,35 @@ AC_DEFUN([AX_PKG_CONFIG_CHECK], [
|
|||
AC_REQUIRE([AX_PROG_PKG_CONFIG])
|
||||
m4_define([_P], AS_TR_SH([m4_toupper([$1])]))
|
||||
m4_define([_p], AS_TR_SH([m4_tolower([$1])]))
|
||||
dnl
|
||||
ver="$2"
|
||||
ver="${ver##*\[<=>\]}"
|
||||
case "$2" in
|
||||
"")
|
||||
vopt=""
|
||||
vtext="$1"
|
||||
;;
|
||||
">=$ver"|">$ver")
|
||||
vopt="--atleast-version=$ver"
|
||||
vtext="$1 $ver or newer"
|
||||
;;
|
||||
"<=$ver"|"<$ver")
|
||||
vopt="--max-version=$ver"
|
||||
vtext="$1 $ver or older"
|
||||
;;
|
||||
"==$ver"|"=$ver"|"$ver")
|
||||
vopt="--exact-version=$ver"
|
||||
vtext="$1 $ver"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([invalid version specification: "$2"])
|
||||
;;
|
||||
esac
|
||||
dnl
|
||||
AC_ARG_VAR(_P[_CFLAGS], [C compiler flags for $1])
|
||||
AC_ARG_VAR(_P[_LIBS], [linker flags for $1])
|
||||
AC_MSG_CHECKING([if $1 is installed])
|
||||
if AC_RUN_LOG(["${PKG_CONFIG}" --exists --print-errors "$1"]) ; then
|
||||
AC_MSG_CHECKING([if ${vtext} is installed])
|
||||
if AC_RUN_LOG(["${PKG_CONFIG}" --exists $vopt --print-errors "$1"]) ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
[ax_pc_cv_have_]_p=yes
|
||||
AC_DEFINE([HAVE_]_P, [1], [Define to 1 if you have $1])
|
||||
|
@ -133,11 +165,11 @@ dnl
|
|||
AC_SUBST(_P[_LIBS], [$ax_pc_cv_]_p[_libs])
|
||||
AC_MSG_RESULT([${ax_pc_cv_]_p[_libs:-none}])
|
||||
dnl
|
||||
m4_default([$2], [:])
|
||||
m4_default([$3], [:])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
[ax_pc_cv_have_]_p=no
|
||||
m4_default([$3], [:])
|
||||
m4_default([$4], [:])
|
||||
fi
|
||||
m4_ifdef([AM_CONDITIONAL], [
|
||||
AM_CONDITIONAL([HAVE_]_P, [test x"$ax_pc_cv_have_]_p[" = x"yes"])
|
||||
|
@ -145,13 +177,13 @@ dnl
|
|||
])
|
||||
|
||||
dnl
|
||||
dnl AX_PKG_CONFIG_REQUIRE(package-name)
|
||||
dnl AX_PKG_CONFIG_REQUIRE(package-name, [version-spec])
|
||||
dnl -----------------------------------
|
||||
dnl
|
||||
dnl As above, but fail if the package is not installed.
|
||||
dnl
|
||||
AC_DEFUN([AX_PKG_CONFIG_REQUIRE], [
|
||||
AX_PKG_CONFIG_CHECK([$1], [], [
|
||||
AX_PKG_CONFIG_CHECK([$1], [$2], [], [
|
||||
AC_MSG_ERROR([cannot proceed without $1])
|
||||
])
|
||||
])
|
||||
|
|
116
m4/cryb_to.m4
Normal file
116
m4/cryb_to.m4
Normal file
|
@ -0,0 +1,116 @@
|
|||
dnl -*- autoconf -*-
|
||||
dnl
|
||||
dnl Copyright (c) 2018 The University of Oslo
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in the
|
||||
dnl documentation and/or other materials provided with the distribution.
|
||||
dnl 3. The name of the author may not be used to endorse or promote
|
||||
dnl products derived from this software without specific prior written
|
||||
dnl permission.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
dnl ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
dnl SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
m4_define([CRYB_MACROS_VERSION], [0.20180506])
|
||||
|
||||
dnl
|
||||
dnl CRYB_INIT
|
||||
dnl ---------
|
||||
dnl
|
||||
dnl Initialize.
|
||||
dnl
|
||||
AC_DEFUN([CRYB_INIT], [
|
||||
AC_ARG_ENABLE([all],
|
||||
AS_HELP_STRING([--disable-all],
|
||||
[disable all components]),
|
||||
[enable_all=$enableval],
|
||||
[enable_all=yes])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl CRYB_LIB_PROVIDE(library-name, [dependencies])
|
||||
dnl ----------------------------------------------
|
||||
dnl
|
||||
dnl Declare a Cryb library that we provide, and its dependencies.
|
||||
dnl
|
||||
AC_DEFUN([CRYB_LIB_PROVIDE], [
|
||||
m4_define([COMP], m4_toupper([$1]))
|
||||
m4_define([comp], m4_tolower([$1]))
|
||||
m4_set_add([cryb_provides], comp)
|
||||
m4_foreach_w([req], [$2], [m4_set_add([cryb_requires], req)])
|
||||
AC_ARG_ENABLE([cryb-]comp,
|
||||
AS_HELP_STRING([--enable-cryb-]comp,
|
||||
[build the ]comp[ library]),
|
||||
[enable_cryb_]comp[=$enableval],
|
||||
[enable_cryb_]comp[=$enable_all])
|
||||
if test [x"$enable_cryb_]comp[" = x"yes"] ; then
|
||||
AC_DEFINE([HAVE_CRYB_]COMP, [1], [Define to 1 if you have $1])
|
||||
AC_SUBST([CRYB_]COMP[_VERSION], [$PACKAGE_VERSION])
|
||||
AC_SUBST([CRYB_]COMP[_CFLAGS], [])
|
||||
AC_SUBST([CRYB_]COMP[_LIBS],
|
||||
['\$(top_builddir)/lib/]comp[/libcryb-]comp[.la]')
|
||||
AM_CONDITIONAL([HAVE_CRYB_]COMP, [true])
|
||||
else
|
||||
AX_PKG_CONFIG_CHECK([cryb-]comp, [$PACKAGE_VERSION])
|
||||
fi
|
||||
AM_CONDITIONAL([CRYB_]COMP, [test [x"$enable_cryb_]comp[" = x"yes"]])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl CRYB_LIB_REQUIRE(library-name)
|
||||
dnl ------------------------------
|
||||
dnl
|
||||
dnl Declare a Cryb library that we require.
|
||||
dnl
|
||||
AC_DEFUN([CRYB_LIB_REQUIRE], [
|
||||
m4_foreach_w([req], [$1], [m4_set_add([cryb_requires], req)])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl CRYB_CHECK_DEPENDENCIES
|
||||
dnl -----------------------
|
||||
dnl
|
||||
dnl Verify that all dependencies have been satisfied.
|
||||
dnl
|
||||
AC_DEFUN([CRYB_CHECK_DEPENDENCIES], [
|
||||
AC_MSG_CHECKING([required Cryb elements])
|
||||
m4_set_foreach([cryb_requires], [req], [
|
||||
if test [x"$enable_cryb_]req[" != x"yes"] && \
|
||||
test [x"$ax_pc_cv_have_cryb_]req[" != x"yes"] ; then
|
||||
AC_MSG_ERROR([missing cryb-]req)
|
||||
fi
|
||||
])
|
||||
AC_MSG_RESULT([ok])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl CRYB_SUMMARY
|
||||
dnl ------------
|
||||
dnl
|
||||
dnl Print a summary of enabled components.
|
||||
dnl
|
||||
AC_DEFUN([CRYB_SUMMARY], [
|
||||
AS_ECHO([])
|
||||
AS_ECHO(["The following Cryb components will be built:"])
|
||||
AS_ECHO([])
|
||||
m4_set_foreach([cryb_provides], [comp], [
|
||||
[printf "%16s: %s\n" ]comp[ ${enable_cryb_]comp[:-no}]
|
||||
])
|
||||
])
|
Loading…
Reference in a new issue