1# Written by Simon Josefsson <simon@yubico.com>. 2# Copyright (c) 2006-2014 Yubico AB 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: 8# 9# * Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 12# * Redistributions in binary form must reproduce the above 13# copyright notice, this list of conditions and the following 14# disclaimer in the documentation and/or other materials provided 15# with the distribution. 16# 17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29AC_INIT([pam_yubico], [2.26]) 30AC_CONFIG_AUX_DIR([build-aux]) 31AC_CONFIG_MACRO_DIR([m4]) 32AM_INIT_AUTOMAKE([1.11 foreign -Wall -Werror]) 33AM_SILENT_RULES([yes]) 34AM_PROG_CC_C_O 35 36m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 37 38AC_LIBTOOL_WIN32_DLL 39AC_DISABLE_STATIC 40AC_PROG_LIBTOOL 41AM_MISSING_PROG([A2X], a2x, $missing_dir) 42 43AC_CHECK_HEADERS([security/pam_appl.h], [], 44 [AC_MSG_ERROR([[PAM header files not found, install libpam-dev.]])]) 45AC_CHECK_HEADERS([security/pam_modules.h security/_pam_macros.h security/pam_modutil.h], [], [], 46 [#include <sys/types.h> 47 #include <security/pam_appl.h>]) 48 49AC_CHECK_LIB([pam], [pam_start], [AC_SUBST([LIBPAM], ["-lpam"])]) 50 51AC_SEARCH_LIBS([pam_modutil_drop_priv], ["pam"], [AC_DEFINE([HAVE_PAM_MODUTIL_DROP_PRIV], [1])]) 52 53AC_ARG_WITH([ldap], 54 [AS_HELP_STRING([--without-ldap], 55 [disable support for ldap])], 56 [], 57 [with_ldap=yes]) 58 59 LIBLDAP= 60 AS_IF([test "x$with_ldap" != xno], 61 [AC_CHECK_LIB([ldap], [ldap_init], 62 [AC_SUBST([LIBLDAP], ["-lldap -llber"]) 63 AC_DEFINE([HAVE_LIBLDAP], [1], 64 [Define if you have libldap]) 65 ], 66 [AC_MSG_WARN( 67 [libldap not found, will not be compiled (--without-ldap to disable ldap support)])], 68 [])]) 69 70 71AC_LIB_HAVE_LINKFLAGS([ykclient],, [#include <ykclient.h>], 72 [ykclient_set_proxy(0, 0)]) 73if test "$ac_cv_libykclient" != yes; then 74 AC_MSG_ERROR([[Libykclient v2.15+ required, see https://developers.yubico.com/yubico-c-client/]]) 75fi 76 77AC_LIB_HAVE_LINKFLAGS(yubikey,, [#include <yubikey.h>], 78 [yubikey_modhex_p("foo")]) 79 80AC_ARG_WITH([cr], 81 [AS_HELP_STRING([--without-cr], 82 [disable support for challenge/response])], 83 [], 84 [with_cr=yes]) 85if test "x$with_cr" != xno; then 86 PKG_CHECK_MODULES([YKPERS], [ykpers-1 >= 1.8.0]); 87 # libyubikey required for HAVE_CR 88 if test "$ac_cv_libyubikey" != yes; then 89 AC_MSG_ERROR([Libyubikey v1.5+ not found, see https://developers.yubico.com/yubico-c/ (required for challenge-response)]) 90 fi 91fi 92if test -n "$YKPERS_LIBS"; then 93 AC_DEFINE([HAVE_CR], [1], [Define if you have libykpers-1 and libyubikey]) 94fi 95AM_CONDITIONAL([YKPERS], [test -n "$YKPERS_LIBS"]) 96 97AC_SUBST(PAMDIR, "\$(exec_prefix)/lib/security") 98AC_ARG_WITH(pam-dir, 99 AC_HELP_STRING([--with-pam-dir=DIR], 100 [Where to install PAM module [[PREFIX/lib/security]]]), 101 [case "${withval}" in 102 /*) PAMDIR="${withval}";; 103 ./*|../*) AC_MSG_ERROR(Bad value for --with-pam-dir);; 104 *) PAMDIR="\$(exec_prefix)/lib/${withval}";; 105 esac]) 106AC_MSG_NOTICE([PAM installation path $PAMDIR]) 107 108AC_ARG_ENABLE([coverage], 109 [AS_HELP_STRING([--enable-coverage], 110 [use Gcov to test the test suite])], 111 [], 112 [enable_cov=no]) 113AM_CONDITIONAL([ENABLE_COV],[test '!' "$enable_cov" = no]) 114 115AC_ARG_ENABLE([cppcheck], 116 [AS_HELP_STRING([--enable-cppcheck], 117 [run cppcheck])], 118 [enable_cppcheck="$enableval"], 119 [enable_cppcheck="no"]) 120 121have_cppcheck=no 122AS_IF([test "x$enable_cppcheck" != xno], 123 [AC_PATH_PROG([CPPCHECK], [cppcheck], [NONE]) 124 AS_IF([test "x$enable_cppcheck" != xno], 125 [have_cppcheck=yes 126 AC_SUBST([CPPCHECK])], 127 [have_cppcheck=no 128 AS_IF([test "x$enable_cppcheck" != xauto], 129 [AC_MSG_ERROR([cannot find cppcheck])])])]) 130AM_CONDITIONAL([ENABLE_CPPCHECK],[test '!' "$have_cppcheck" = no]) 131 132AC_ARG_ENABLE([gcc-warnings], 133 [AS_HELP_STRING([--enable-gcc-warnings], 134 [turn on lots of GCC warnings (for developers)])], 135 [case $enableval in 136 yes|no) ;; 137 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; 138 esac 139 gl_gcc_warnings=$enableval], 140 [gl_gcc_warnings=no] 141) 142 143if test "$gl_gcc_warnings" = yes; then 144 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings 145 nw="$nw -Wpadded" # Struct's arenot padded 146 nw="$nw -Wc++-compat" # We don't care strongly about C++ compilers 147 nw="$nw -Wtraditional" # Warns on #elif which we use often 148 nw="$nw -Wtraditional-conversion" # Too many warnings for now 149 nw="$nw -Wconversion" # Too many warnings for now 150 nw="$nw -Wsuggest-attribute=pure" # Is it worth using attributes? 151 nw="$nw -Woverlength-strings" # Don't warn on long strings 152 153 gl_MANYWARN_ALL_GCC([ws]) 154 gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw]) 155 for w in $ws; do 156 gl_WARN_ADD([$w]) 157 done 158 159 gl_WARN_ADD([-fdiagnostics-show-option]) 160fi 161 162AC_CONFIG_FILES(Makefile) 163AC_CONFIG_FILES(tests/Makefile) 164AC_OUTPUT 165 166AC_MSG_NOTICE([Summary of build options: 167 168 Version: ${VERSION} 169 Host type: ${host} 170 Install prefix: ${prefix} 171 Compiler: ${CC} 172 Library types: Shared=${enable_shared}, Static=${enable_static} 173 LDAP: ${with_ldap} 174 Challenge-Response: ${with_cr} 175]) 176