1# This file is part of pam-modules. -*- autoconf -*- 2# Copyright (C) 2005-2012, 2014-2015, 2018 Sergey Poznyakoff 3# 4# This program is free software; you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation; either version 3, or (at your option) 7# any later version. 8# 9# This program is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License along 15# with this program. If not, see <http://www.gnu.org/licenses/>. 16 17AC_PREREQ(2.63) 18 19AC_INIT(pam-modules, 2.2, bug-pam-modules@gnu.org.ua) 20AC_CONFIG_SRCDIR(pam_fshadow/pam_fshadow.c) 21AC_CONFIG_AUX_DIR([build-aux]) 22AC_CONFIG_MACRO_DIR([m4]) 23AM_INIT_AUTOMAKE([1.11 no-exeext tar-ustar dist-xz silent-rules]) 24AM_CONFIG_HEADER(config.h) 25 26# Enable silent rules by default: 27AM_SILENT_RULES([yes]) 28 29dnl Library versioning 30AC_SUBST(VI_CURRENT,1) 31AC_SUBST(VI_REVISION,0) 32AC_SUBST(VI_AGE,0) 33 34dnl Checks for programs. 35AC_PROG_CC 36AC_PROG_INSTALL 37 38LT_PREREQ(2.2.5a) 39LT_INIT 40 41dnl Checks for libraries. 42AC_CHECK_LIB(pam, pam_get_item,:, 43 [AC_MSG_ERROR([Required library libpam is not found])]) 44 45AC_ARG_WITH(crypt-lib, 46 AC_HELP_STRING([--with-crypt-lib=LIB], 47 [use -lLIB instead of -lcrypt]), 48 [cryptlib=$withval], 49 [cryptlib=crypt]) 50 51if test "x$cryptlib" != xno; then 52 AC_CHECK_LIB($cryptlib, crypt) 53fi 54AC_SUBST(PAM_MISC) 55AH_TEMPLATE([HAVE_PAM_MISC_SETENV],[Define if pam_misc_setenv is available.]) 56AC_CHECK_LIB(pam_misc, pam_misc_setenv, 57 [PAM_MISC=-lpam_misc 58 AC_DEFINE([HAVE_PAM_MISC_SETENV],1)],:,[-lpam]) 59 60dnl Checks for header files. 61AC_HEADER_STDC 62AC_CHECK_HEADERS(security/pam_appl.h security/pam_modules.h, 63 :, 64 AC_MSG_ERROR([Required PAM header files not found])) 65AC_CHECK_HEADERS(fcntl.h syslog.h unistd.h crypt.h security/_pam_aconf.h \ 66 security/pam_misc.h security/pam_ext.h termios.h \ 67 shadow.h) 68 69dnl Checks for typedefs, structures, and compiler characteristics. 70AC_C_CONST 71 72AC_CHECK_HEADERS([shadow.h]) 73AC_CHECK_FUNCS(fgetspent) 74AC_CHECK_TYPES(struct spwd, , , 75 [ #include <shadow.h> ]) 76AC_CHECK_MEMBERS([struct spwd.sp_expire], , , 77 [ #include <shadow.h> ]) 78 79dnl Checks for library functions. 80AC_CHECK_FUNCS(strerror tcgetattr fgetpwent) 81 82 83PM_ENABLE(fshadow) 84PM_ENABLE(log) 85PM_ENABLE(regex) 86PM_ENABLE(groupmember) 87 88# Check for SQL support 89 90AC_ARG_WITH(mysql, 91 AC_HELP_STRING([--without-mysql], 92 [Configure to work without MySQL]), 93 [want_mysql=$withval]) 94AC_ARG_WITH(pgsql, 95 AC_HELP_STRING([--without-pgsql], 96 [Configure to work without Postgres]), 97 [want_pgsql=$withval]) 98AC_ARG_WITH(postgres, 99 AC_HELP_STRING([--without-postgres], 100 [Same as --without-pgsql]), 101 [want_pgsql=$withval]) 102AC_ARG_WITH(sql, 103 AC_HELP_STRING([--without-sql], 104 [Do not build SQL dependent modules]), 105 [want_mysql=$withval 106 want_pgsql=$withval]) 107 108PM_ENABLE(mysql, [ 109 if test "$want_mysql" != no; then 110 PM_CHECK_LIB(mysqlclient, mysql_real_connect, "-lm", 111 [ AC_DEFINE(USE_SQL_MYSQL,1, 112 [Define this if you are going to use MySQL]) 113 AC_DEFINE(HAVE_LIBMYSQL,1, 114 [Define this if you have mysqlclient library]) 115 MYSQLLIBS="$pm_cv_lib_mysqlclient" 116 SQL_MODULES="$SQL_MODULES pam_mysql.la" 117 build_mysql=yes ], 118 [ test "$build_mysql" = yes && AC_MSG_ERROR([cannot build the requested module pam_mysql, because MySQL libraries are not present]) 119 build_mysql=no ], 120 [/usr/lib/mysql /usr/local/lib/mysql]) 121 fi 122]) 123 124PM_ENABLE(pgsql, [ 125 if test "$want_pgsql" != no; then 126 PM_CHECK_LIB(pq, PQconnectStart, [], 127 [ save_CPPFLAGS=$CPPFLAGS 128 for dir in /usr/local/pgsql/include /usr/pgsql/include 129 do 130 CPPFLAGS="$save_CPPFLAGS -I$dir" 131 AC_CHECK_HEADER([libpq-fe.h], [break]) 132 CPPFLAGS="$save_CPPFLAGS" 133 done 134 AC_DEFINE(USE_SQL_PGSQL,1, 135 [Define this if you are going to use PostgreSQL]) 136 AC_DEFINE(HAVE_LIBPQ,1, 137 [Define this if you have libpq]) 138 PGSQLLIBS="$pm_cv_lib_pq" 139 SQL_MODULES="$SQL_MODULES pam_pgsql.la" 140 build_pgsql=yes ], 141 [ test "$build_pgsql" = yes && AC_MSG_ERROR([cannot build the requested module pma_pgsql, because PostgreSQL libraries are not present]) 142 build_pgsql=no ], 143 [/usr/pgsql/lib /usr/local/pgsql/lib]) 144 fi 145]) 146 147AC_SUBST(MYSQLLIBS) 148AC_SUBST(PGSQLLIBS) 149AC_SUBST(SQL_MODULES) 150 151# LDAP support 152PM_ENABLE(ldaphome,[ 153 AC_CHECK_LIB(ldap, ldap_bind, 154 [build_ldaphome=yes], 155 [if test $build_ldaphome = yes; then 156 AC_MSG_ERROR([cannot build pam_ldaphome, because the required library libldap is not found]) 157 else 158 build_ldaphome=no 159 fi]) 160]) 161 162# 163PM_ENABLE(umotd,[ 164case $build_umotd in 165probe) 166 build_umotd=$ac_cv_header_security_pam_ext_h 167 ;; 168yes) 169 test $ac_cv_header_security_pam_ext_h = no && AC_MSG_ERROR([Cannot build pam_umotd, because the required header security/pam_ext.h is not present]) 170 ;; 171esac 172]) 173 174## ***************** 175## debugging support 176## ***************** 177AC_ARG_ENABLE(debug, 178 AC_HELP_STRING([--enable-debug], [enable debugging mode]), 179 [if test "$enableval" = yes; then 180 if test "$GCC" = yes; then 181 AC_MSG_CHECKING(whether gcc accepts -ggdb) 182 save_CFLAGS=$CFLAGS 183 CFLAGS="-ggdb -Wall" 184 AC_TRY_COMPILE([],void f(){}, 185 AC_MSG_RESULT(yes), 186 [if test x"$ac_cv_prog_cc_g" = xyes; then 187 CFLAGS="-g -Wall" 188 else 189 CFLAGS= 190 fi 191 AC_MSG_RESULT(no)]) 192 CFLAGS="`echo $save_CFLAGS | sed 's/-O[[0-9]]//g'` $CFLAGS" 193 AC_DEFINE_UNQUOTED([DEBUG_MODE],1,[Define to enable debugging]) 194 fi 195 fi]) 196 197## ************** 198## Directories 199## ************** 200PAMDIR='$(prefix)/lib/security' 201AC_ARG_WITH(pamdir, 202 AC_HELP_STRING([--with-pamdir=DIR], 203 [install PAM modiles in DIR (PREFIX/lib/security)]), 204 [PAMDIR=$withval]) 205AC_SUBST(PAMDIR) 206 207## ************** 208## Imprimatur 209## ************** 210IMPRIMATUR_INIT 211 212## ************** 213## Summary 214## ************** 215 216AC_CONFIG_COMMANDS([status],[ 217echo "" 218delim="-------------------------------------------------------------------" 219echo $delim | tr '-' '*' 220echo "Modules to build:" 221res= 222for module in fshadow regex log pgsql mysql ldaphome umotd groupmember 223do 224 modname=pam_$module 225 eval enable=\${build_$module} 226 str=`echo ${modname}" yes" | sed 's/./-/g'` 227 dstr=`echo $delim | sed "s/^$str//" | tr '-' '.'` 228 echo ${modname}$dstr $enable 229 res="$res$enable" 230done 231echo $delim | tr '-' '*' 232case "$res" in 233*yes*) ;; 234*) 235 AC_MSG_ERROR([Nothing to build?]) 236esac 237],[ 238build_fshadow=$build_fshadow 239build_regex=$build_regex 240build_log=$build_log 241build_pgsql=$build_pgsql 242build_mysql=$build_mysql 243build_ldaphome=$build_ldaphome 244build_umotd=$build_umotd 245build_groupmember=$build_groupmember]) 246 247AC_OUTPUT(Makefile 248 doc/Makefile 249 examples/Makefile 250 lib/Makefile 251 pam_fshadow/Makefile 252 pam_regex/Makefile 253 pam_log/Makefile 254 pam_sql/Makefile 255 pam_ldaphome/Makefile 256 pam_umotd/Makefile 257 pam_groupmember/Makefile 258 pamck/Makefile) 259