Update to latest version of Cryb build system.

This commit is contained in:
Dag-Erling Smørgrav 2018-05-13 00:29:06 +02:00
parent f7e4233b4c
commit 573227933a
11 changed files with 89 additions and 130 deletions

View file

@ -1,5 +1,5 @@
SUBDIRS =
if OTP_UTIL
if CRYB_CLI
SUBDIRS += otpkey
endif OTP_UTIL
endif CRYB_CLI

View file

@ -1,5 +1,5 @@
AC_PREREQ([2.63])
AC_INIT([cryb.otp], [0.20180426], [des@des.no], [cryb-otp], [http://cryb.to/])
AC_INIT([cryb.otp], [0.20180506], [des@des.no], [cryb-otp], [http://cryb.to/])
AC_CONFIG_SRCDIR([include/cryb/otp.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz])
@ -75,31 +75,6 @@ AC_CHECK_DECLS([
AC_CHECK_FUNCS([strlcat strlcmp strlcpy])
AC_CHECK_FUNCS([wcslcat wcslcmp wcslcpy])
############################################################################
#
# Extra libraries
#
# Cryb.to components
AX_PKG_CONFIG_REQUIRE([cryb-core])
AX_PKG_CONFIG_REQUIRE([cryb-oath])
# Cryb.to test framework
AX_PKG_CONFIG_CHECK([cryb-test],
[AC_MSG_NOTICE([Cryb test framework found, unit tests enabled.])],
[AC_MSG_WARN([Cryb test framework not found, unit tests disabled.])])
# libpam
save_LIBS="${LIBS}"
LIBS=""
AC_SEARCH_LIBS([pam_start], [pam], [
PAM_LIBS="${LIBS}"
], [
PAM_LIBS=""
])
LIBS="${save_LIBS}"
AC_SUBST(PAM_LIBS)
############################################################################
#
# Build options
@ -143,77 +118,29 @@ AC_ARG_ENABLE([werror],
#
# Components
#
CRYB_INIT
# Everything
AC_ARG_ENABLE([all],
AS_HELP_STRING([--disable-all],
[disable all libraries and tools]),
[enable_all=$enableval],
[enable_all=yes])
CRYB_LIB_REQUIRE([digest test])
# Library
elements="$elements lib"
AC_ARG_ENABLE([otp-lib],
AS_HELP_STRING([--enable-otp-lib],
[build the OTP library]),
[enable_otp_lib=$enableval],
[enable_otp_lib=$enable_all])
AM_CONDITIONAL([OTP_LIB], [test x"$enable_otp_lib" = x"yes"])
CRYB_LIB_PROVIDE([otp], [core oath])
# BSD Auth module
elements="$elements bsdauth"
requires="$requires bsdauth:lib"
AC_ARG_ENABLE([otp-bsdauth],
AS_HELP_STRING([--enable-otp-bsdauth],
[build the BSD Auth module]),
[enable_otp_bsdauth=$enableval],
[enable_otp_bsdauth=$enable_all])
AM_CONDITIONAL([OTP_BSDAUTH], [test x"$enable_otp_bsdauth" = x"yes"])
CRYB_PROVIDE([bsdauth], [otp])
CRYB_PROVIDE([pam], [otp])
CRYB_PROVIDE([radius], [otp])
CRYB_PROVIDE([cli], [otp])
# PAM module
elements="$elements pam"
requires="$requires pam:lib"
AC_ARG_ENABLE([otp-pam],
AS_HELP_STRING([--enable-otp-pam],
[build the PAM module]),
[enable_otp_pam=$enableval],
[enable_otp_pam=$enable_all])
AM_CONDITIONAL([OTP_PAM], [test x"$enable_otp_pam" = x"yes"])
if test x"$enable_cryb_pam" = x"yes" ; then
save_LIBS="${LIBS}"
LIBS=""
AC_CHECK_LIB([pam], [pam_start], [], [
AC_MSG_ERROR([libpam is required to build the PAM module])
])
PAM_LIBS="${LIBS}"
LIBS="${save_LIBS}"
AC_SUBST(PAM_LIBS)
fi
# RADIUS server
elements="$elements radius"
requires="$requires radius:lib"
AC_ARG_ENABLE([otp-radius],
AS_HELP_STRING([--enable-otp-radius],
[build the RADIUS server]),
[enable_otp_radius=$enableval],
[enable_otp_radius=$enable_all])
AM_CONDITIONAL([OTP_RADIUS], [test x"$enable_otp_radius" = x"yes"])
# Command-line utilities
elements="$elements util"
requires="$requires util:lib"
AC_ARG_ENABLE([otp-util],
AS_HELP_STRING([--enable-otp-util],
[build the command-line utilities]),
[enable_otp_util=$enableval],
[enable_otp_util=$enable_all])
AM_CONDITIONAL([OTP_UTIL], [test x"$enable_otp_util" = x"yes"])
# Check dependencies
AC_MSG_CHECKING([dependencies])
for req in $requires ; do
lhs=${req%:*}
lhs_ena=`eval echo \\\$enable_otp_$lhs`
if test x"$lhs_ena" = x"yes" ; then
rhs=${req#*:}
rhs_ena=`eval echo \\\$enable_otp_$rhs`
if test x"$rhs_ena" != x"yes" ; then
AC_MSG_ERROR([otp-$lhs requires otp-$rhs])
fi
fi
done
AC_MSG_RESULT([ok])
CRYB_RESOLVE
############################################################################
#
@ -239,11 +166,4 @@ AC_CONFIG_FILES([
])
AC_OUTPUT
echo
echo The following Cryb OTP components will be built:
echo
for elem in $elements ; do
enable=`eval echo \\\$enable_otp_$elem`
printf "%16s: %s\n" $elem ${enable:-no}
done
echo
CRYB_SUMMARY

View file

@ -2,9 +2,10 @@ crybdir = $(includedir)/cryb
cryb_HEADERS =
if OTP_LIB
cryb_HEADERS += otp.h
endif OTP_LIB
if CRYB_OTP
cryb_HEADERS += \
otp.h
endif CRYB_OTP
noinst_HEADERS = \
impl.h

View file

@ -1,5 +1,5 @@
SUBDIRS =
if OTP_LIB
if CRYB_OTP
SUBDIRS += otp
endif OTP_LIB
endif CRYB_OTP

View file

@ -1,5 +1,5 @@
SUBDIRS =
if OTP_BSDAUTH
if CRYB_BSDAUTH
SUBDIRS += login_otp
endif
endif CRYB_BSDAUTH

View file

@ -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])
])
])

View file

@ -1,5 +1,5 @@
SUBDIRS =
if OTP_PAM
if CRYB_PAM
SUBDIRS += pam_otp
endif OTP_PAM
endif CRYB_PAM

View file

@ -1,5 +1,5 @@
SUBDIRS =
if OTP_RADIUS
if CRYB_RADIUS
SUBDIRS += otpradiusd
endif OTP_RADIUS
endif CRYB_RADIUS

View file

@ -7,8 +7,14 @@ sbin_PROGRAMS = otpradiusd
otpradiusd_SOURCES = otpradiusd.c
otpradiusd_CFLAGS = \
$(CRYB_OATH_CFLAGS) \
$(CRYB_DIGEST_CFLAGS) \
$(CRYB_CORE_CFLAGS)
otpradiusd_LDADD = $(libotp)
otpradiusd_LDADD = \
$(libotp) \
$(CRYB_OATH_CFLAGS) \
$(CRYB_DIGEST_CFLAGS) \
$(CRYB_CORE_CFLAGS)
dist_man8_MANS = otpradiusd.8

View file

@ -14,14 +14,14 @@ TESTS += t_cxx
t_cxx_SOURCES = t_cxx.cc
t_cxx_CPPFLAGS = $(AM_CPPFLAGS) $(CRYB_CORE_CFLAGS)
t_cxx_LDADD =
if OTP_LIB
t_cxx_CPPFLAGS += -DWITH_OTP_LIB
if CRYB_OTP
t_cxx_CPPFLAGS += -DWITH_CRYB_OTP
t_cxx_LDADD += $(libotp)
endif OTP_LIB
endif CRYB_OTP
# libcryb-otp
if OTP_LIB
endif OTP_LIB
if CRYB_OTP
endif CRYB_OTP
check_PROGRAMS = $(TESTS)

View file

@ -57,7 +57,7 @@ public:
} \
};
#if WITH_OTP_LIB
#if WITH_CRYB_OTP
#include <cryb/otp.h>
TEST(otp)
#endif