diff --git a/bin/Makefile.am b/bin/Makefile.am index 2f62bd3..979a74e 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = -if OTP_UTIL +if CRYB_CLI SUBDIRS += otpkey -endif OTP_UTIL +endif CRYB_CLI diff --git a/configure.ac b/configure.ac index 565495e..26903b2 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/include/cryb/Makefile.am b/include/cryb/Makefile.am index fb4466c..94124fb 100644 --- a/include/cryb/Makefile.am +++ b/include/cryb/Makefile.am @@ -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 diff --git a/lib/Makefile.am b/lib/Makefile.am index 49a14af..27a1122 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = -if OTP_LIB +if CRYB_OTP SUBDIRS += otp -endif OTP_LIB +endif CRYB_OTP diff --git a/libexec/Makefile.am b/libexec/Makefile.am index afd5240..6e5160f 100644 --- a/libexec/Makefile.am +++ b/libexec/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = -if OTP_BSDAUTH +if CRYB_BSDAUTH SUBDIRS += login_otp -endif +endif CRYB_BSDAUTH diff --git a/m4/ax_pkg_config.m4 b/m4/ax_pkg_config.m4 index a888c65..6be3dd2 100644 --- a/m4/ax_pkg_config.m4 +++ b/m4/ax_pkg_config.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]) ]) ]) diff --git a/pam/Makefile.am b/pam/Makefile.am index 8a3f53e..ea9d488 100644 --- a/pam/Makefile.am +++ b/pam/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = -if OTP_PAM +if CRYB_PAM SUBDIRS += pam_otp -endif OTP_PAM +endif CRYB_PAM diff --git a/sbin/Makefile.am b/sbin/Makefile.am index 9863ee3..6fced73 100644 --- a/sbin/Makefile.am +++ b/sbin/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = -if OTP_RADIUS +if CRYB_RADIUS SUBDIRS += otpradiusd -endif OTP_RADIUS +endif CRYB_RADIUS diff --git a/sbin/otpradiusd/Makefile.am b/sbin/otpradiusd/Makefile.am index 66b008d..438e383 100644 --- a/sbin/otpradiusd/Makefile.am +++ b/sbin/otpradiusd/Makefile.am @@ -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 diff --git a/t/Makefile.am b/t/Makefile.am index 3558472..7941534 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -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) diff --git a/t/t_cxx.cc b/t/t_cxx.cc index 69fbc02..80dffa6 100644 --- a/t/t_cxx.cc +++ b/t/t_cxx.cc @@ -57,7 +57,7 @@ public: } \ }; -#if WITH_OTP_LIB +#if WITH_CRYB_OTP #include TEST(otp) #endif