1# Copyright (C) 2014-2019 Yubico AB 2AC_PREREQ([2.65]) 3AC_INIT([pam_u2f], [1.2.0], [https://github.com/Yubico/pam-u2f/issues], 4 [pam_u2f], [https://developers.yubico.com/pam-u2f/]) 5 6AC_CONFIG_AUX_DIR([build-aux]) 7AC_CONFIG_MACRO_DIR([m4]) 8AC_CANONICAL_HOST 9 10AM_INIT_AUTOMAKE([1.11 foreign subdir-objects]) 11 12AM_SILENT_RULES([yes]) 13AM_MAINTAINER_MODE 14 15AC_USE_SYSTEM_EXTENSIONS 16AM_PROG_CC_C_O 17AM_PROG_AR 18AC_LIBTOOL_WIN32_DLL 19AC_DISABLE_STATIC 20AC_PROG_LIBTOOL 21AC_PROG_CC_STDC 22 23AC_ARG_ENABLE([man], 24 [AS_HELP_STRING([--disable-man], [Disable man page generation])], 25 [:], 26 [enable_man=yes] 27 ) 28AS_IF([test "$enable_man" = "yes"], 29 [AM_MISSING_PROG([A2X], a2x, $missing_dir)] 30) 31AM_CONDITIONAL([ENABLE_MAN], [test "$enable_man" = "yes"]) 32 33AC_ARG_ENABLE([fuzzing], 34 [AS_HELP_STRING([--enable-fuzzing], [Enable fuzzing targets])] 35) 36AS_IF([test "$enable_fuzzing" = "yes"],[ 37 AC_DEFINE([WITH_FUZZING]) 38]) 39AM_CONDITIONAL([ENABLE_FUZZING], [test "$enable_fuzzing" = "yes"]) 40 41AC_CHECK_HEADERS([security/pam_appl.h], [], 42 [AC_MSG_ERROR([[PAM header files not found, install libpam-dev.]])]) 43AC_CHECK_HEADERS([security/pam_modules.h security/_pam_macros.h security/pam_modutil.h security/openpam.h], [], [], 44 [#include <sys/types.h> 45 #include <security/pam_appl.h>]) 46AC_CHECK_LIB([pam], [pam_start]) 47AC_CHECK_FUNCS([pam_modutil_drop_priv openpam_borrow_cred]) 48 49case "$host" in 50 *darwin*) PAMDIR="/usr/lib/pam";; 51 *linux*) PAMDIR="/lib/x86_64-linux-gnu/security";; 52 *) PAMDIR="/usr/lib" 53esac 54AC_ARG_WITH(pam-dir, 55 AC_HELP_STRING([--with-pam-dir=DIR], [Where to install the PAM module]), [ 56 case "${withval}" in 57 /*) PAMDIR="${withval}";; 58 ./*|../*) AC_MSG_ERROR(Bad value for --with-pam-dir);; 59 *);; 60 esac 61]) 62AC_SUBST(PAMDIR, "$PAMDIR") 63 64 65PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto], [], []) 66PKG_CHECK_MODULES([LIBFIDO2], [libfido2 >= 1.3.0], [], []) 67 68 69# Check for secure_getenv, strlcpy, readpassphrase, explicit_bzero, and memset_s 70am_save_CFLAGS="$CFLAGS" 71am_save_LIBS="$LIBS" 72CFLAGS="$CFLAGS" 73LIBS="$LIBS" 74AC_CHECK_FUNCS([secure_getenv strlcpy readpassphrase explicit_bzero memset_s]) 75CFLAGS=$am_save_CFLAGS 76LIBS=$am_save_LIBS 77 78# Make clang emit errors for unknown warnings to make the AX_CHECK_COMPILE_FLAG 79# macro behave as intended, excluding unsupported flags. 80AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option], [check_extra_flags="-Werror=unknown-warning-option"]) 81 82AC_ARG_VAR([CWFLAGS], [Warning flags]) 83AX_CHECK_COMPILE_FLAG([-Wall], [CWFLAGS="-Wall"], [], [$check_extra_flags]) 84AX_CHECK_COMPILE_FLAG([-Wextra], [CWFLAGS="$CWFLAGS -Wextra"], [], [$check_extra_flags]) 85AX_CHECK_COMPILE_FLAG([-Wconversion], [CWFLAGS="$CWFLAGS -Wconversion"], [], [$check_extra_flags]) 86# Because pam headers are doing sign-conversion, see PAM_MODUTIL_DEF_PRIVS in pam_modutil.h 87AX_CHECK_COMPILE_FLAG([-Wconversion], [CWFLAGS="$CWFLAGS -Wno-sign-conversion"], [], [$check_extra_flags]) 88AX_CHECK_COMPILE_FLAG([-Wpedantic], [CWFLAGS="$CWFLAGS -Wpedantic"], [], [$check_extra_flags]) 89AX_CHECK_COMPILE_FLAG([-Wformat=2], [CWFLAGS="$CWFLAGS -Wformat=2"], [], [$check_extra_flags]) 90AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CWFLAGS="$CWFLAGS -Wstrict-prototypes"], [], [$check_extra_flags]) 91AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [CWFLAGS="$CWFLAGS -Wmissing-declarations"], [], [$check_extra_flags]) 92AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CWFLAGS="$CWFLAGS -Wmissing-prototypes"], [], [$check_extra_flags]) 93AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [CWFLAGS="$CWFLAGS -Wnull-dereference"], [], [$check_extra_flags]) 94AX_CHECK_COMPILE_FLAG([-Wshadow], [CWFLAGS="$CWFLAGS -Wshadow"], [], [$check_extra_flags]) 95AX_CHECK_COMPILE_FLAG([-Wpointer-arith], [CWFLAGS="$CWFLAGS -Wpointer-arith"], [], [$check_extra_flags]) 96 97AC_ARG_VAR([CSFLAGS], [Warning suppression flags]) 98AX_CHECK_COMPILE_FLAG([-Wno-unused-but-set-variable], [CSFLAGS="-Wno-unused-but-set-variable"], [], [$check_extra_flags]) 99 100AC_CONFIG_FILES([ 101 Makefile 102 pamu2fcfg/Makefile 103 tests/Makefile 104 fuzz/Makefile 105]) 106 107creduser=$(whoami) 108AC_SUBST(USERNAME, $creduser) 109AC_CONFIG_FILES([tests/credentials/new_double_-N.cred]) 110AC_CONFIG_FILES([tests/credentials/new_double_-P-N.cred]) 111AC_CONFIG_FILES([tests/credentials/new_double_-P.cred]) 112AC_CONFIG_FILES([tests/credentials/new_double_-P-V-N.cred]) 113AC_CONFIG_FILES([tests/credentials/new_double_-P-V.cred]) 114AC_CONFIG_FILES([tests/credentials/new_double_-r-N.cred]) 115AC_CONFIG_FILES([tests/credentials/new_double_-r-P-N.cred]) 116AC_CONFIG_FILES([tests/credentials/new_double_-r-P.cred]) 117AC_CONFIG_FILES([tests/credentials/new_double_-r-P-V-N.cred]) 118AC_CONFIG_FILES([tests/credentials/new_double_-r-P-V.cred]) 119AC_CONFIG_FILES([tests/credentials/new_double_-r.cred]) 120AC_CONFIG_FILES([tests/credentials/new_double_-r-V-N.cred]) 121AC_CONFIG_FILES([tests/credentials/new_double_-r-V.cred]) 122AC_CONFIG_FILES([tests/credentials/new_double_.cred]) 123AC_CONFIG_FILES([tests/credentials/new_double_-V-N.cred]) 124AC_CONFIG_FILES([tests/credentials/new_double_-V.cred]) 125AC_CONFIG_FILES([tests/credentials/new_mixed_12.cred]) 126AC_CONFIG_FILES([tests/credentials/new_mixed_1-P2.cred]) 127AC_CONFIG_FILES([tests/credentials/new_mixed_-P12.cred]) 128AC_CONFIG_FILES([tests/credentials/new_mixed_-P1-P2.cred]) 129AC_CONFIG_FILES([tests/credentials/new_-N.cred]) 130AC_CONFIG_FILES([tests/credentials/new_-P-N.cred]) 131AC_CONFIG_FILES([tests/credentials/new_-P.cred]) 132AC_CONFIG_FILES([tests/credentials/new_-P-V-N.cred]) 133AC_CONFIG_FILES([tests/credentials/new_-P-V.cred]) 134AC_CONFIG_FILES([tests/credentials/new_-r-N.cred]) 135AC_CONFIG_FILES([tests/credentials/new_-r-P-N.cred]) 136AC_CONFIG_FILES([tests/credentials/new_-r-P.cred]) 137AC_CONFIG_FILES([tests/credentials/new_-r-P-V-N.cred]) 138AC_CONFIG_FILES([tests/credentials/new_-r-P-V.cred]) 139AC_CONFIG_FILES([tests/credentials/new_-r.cred]) 140AC_CONFIG_FILES([tests/credentials/new_-r-V-N.cred]) 141AC_CONFIG_FILES([tests/credentials/new_-r-V.cred]) 142AC_CONFIG_FILES([tests/credentials/new_.cred]) 143AC_CONFIG_FILES([tests/credentials/new_-V-N.cred]) 144AC_CONFIG_FILES([tests/credentials/new_-V.cred]) 145AC_CONFIG_FILES([tests/credentials/old_credential.cred]) 146AC_CONFIG_FILES([tests/credentials/ssh_credential.cred]) 147AC_OUTPUT 148 149 150AC_MSG_NOTICE([Summary of build options: 151 152 Version: ${VERSION} 153 Host type: ${host} 154 Install prefix: ${prefix} 155 Compiler: ${CC} 156 CFLAGS: ${CFLAGS} 157 CWFLAGS: ${CWFLAGS} 158 CSFLAGS: ${CSFLAGS} 159 Library types: Shared=${enable_shared}, Static=${enable_static} 160 LIBFIDO2 CFLAGS: $LIBFIDO2_CFLAGS 161 LIBFIDO2 LIBS: $LIBFIDO2_LIBS 162 LIBCRYPTO CFLAGS: $LIBCRYPTO_CFLAGS 163 LIBCRYPTO LIBS: $LIBCRYPTO_LIBS 164 PAMDIR: $PAMDIR 165]) 166